Tuesday 15 September 2015

How can I tell if an error occurred in a function call in javascript? -



How can I tell if an error occurred in a function call in javascript? -

i have next code structure:

callfunction() if (there error in callfunction()){ //execute code }

what can set in place of 'there error in callfunction()' tell me error called in function? there line should add together callfunction itself?

try catch 1 way it. http://www.w3schools.com/js/js_errors.asp

for example:

function myfunction() { seek { //some code execute } grab (e) { //throw alert message if seek statement failed alert(e.tostring()); } }

javascript

No comments:

Post a Comment