Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7735705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:34:04+00:00 2026-06-01T07:34:04+00:00

I was wondering how to handle errors inside a script that is meant to

  • 0

I was wondering how to handle errors inside a script that is meant to be used as a “parser”. Basically I need a way to handle parsing errors.

Since the text that this script parses should be provided in the HTML, I guess throwing the error in the javascript console is not an option, right? The user of the script should not be aware of this script, he just needs to know the syntax required for a certain HTML attribute in order to change the way the element behaves. Think of it like markdown., the only difference is that my parser will not generate any html, text, etc., it just hides or shows certain input elements if they meet conditions provided in the text to be parsed.

Should I stick with a simple browser alert message?

Appending an error message in the document (near the element that contains the text to be parsed) is not really an option, because the point of this script is to modify behaviour of certain input elements, and not to append text or something like that. Besides, it would produce inconsistent styling..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:34:05+00:00Added an answer on June 1, 2026 at 7:34 am

    you can use try catch like:

    <script type="text/javascript">
    
    try {
        // Code to run
        [break;]
    } catch ( e ) {
        // Code to run if an exception occurs
        [break;]
    }[ finally {
        // Code that is always executed regardless of 
        // an exception occurring
    }]
    
    </script>
    

    More dtails are here: Javascript

    create function which would parse your code and put it inside try catch:- hope this helps you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering what would be the best way to handle errors in an
I was wondering what's the best way to handle errors in programmation (i'm coding
I'm trying to handle this possible exploit and wondering what is the best way
I am wondering if there is a way to handle this more elegantly. After
I was wondering if there was a standard way for backbone models/controllers to handle
I am wondering how to best handle javascript errors. My application is pretty javascript
I'm building a web application, and am wondering how to handle errors with my
i'm wondering if there's a way to handle mysql error and configure ci to
I'm wondering how others handle this situation... and how to apply the Don't Repeat
I was wondering how to handle separately users and members in an application where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.