linux - How to handle an Error correctly using Javascript? -
when want send , error using javascript do:
throw new error()
it works, if pass number, example:
throw new error(500)
the result is:
error: 500
where 'error: ' string.
i have function handle errors, function must know code of error, how retrieve it? have parse string? :-(
thank you.
if throw error way, text between parenthesis becomes error message. can throw using a custom error object.
a useful link: the art of throwing javascript errors
Comments
Post a Comment