Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

throw new error(

try {
    //something that causes an error
} catch (ex){
    if (ex instanceof TypeError){
        //handle the error
    } else if (ex instanceof ReferenceError){
        //handle the error
    } else {
        //handle all others
    }
}
Source by humanwhocodes.com #
 
PREVIOUS NEXT
Tagged: #throw
ADD COMMENT
Topic
Name
9+5 =