Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript Rethrow an Exception

const number = 5;
try {
     // user-defined throw statement
     throw new Error('This is the throw');
}
catch(error) {
    console.log('An error caught');
    if( number + 8 > 10) {

        // statements to handle exceptions
         console.log('Error message: ' + error); 
        console.log('Error resolved');
    }
    else {
        // cannot handle the exception
        // rethrow the exception
        throw new Error('The value is low');
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript rest parameter 
Javascript :: javascript Arrow Function with Promises and Callbacks 
Javascript :: return number less than in 250 
Javascript :: javascript WeakSets Are Not iterable 
Javascript :: javascript for...of with Maps 
Javascript :: date methods javascript 
Javascript :: javascript Using yield to Pause Execution 
Javascript :: JavaScript Iterables 
Javascript :: react destructuring with rename 
Javascript :: The first article title 
Javascript :: GetAsync() with a dateime 
Javascript :: how to convert a title to a url slug in jquery 
Javascript :: fingerprint2 
Javascript :: get html element coords with js 
Javascript :: Alternate capitalization 
Javascript :: phaser spread 
Javascript :: phaser remove animation event 
Javascript :: swr vs axios 
Javascript :: after end time run function 
Javascript :: javascript fiori 
Javascript :: sadd in redis 
Javascript :: usestate access previous state 
Javascript :: spread 
Javascript :: export default function react 
Javascript :: convert html to javascript 
Javascript :: js unshift vs push 
Javascript :: javascript self executing function 
Javascript :: play sound onload react 
Javascript :: how to get the last element of an array in javascript 
Javascript :: javascript get all elements by class starting with 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =