JSFiddle - React, Tailwind, and code Playground
JavaScript
//Throw an Error object.
try{
throw new Error("Message in Error Object");
}catch(e){
console.log(e);//Error: Message in Error Object
}
try{
throw "Raw Message";
}catch(message){
console.log(message);//Raw Message
console.log(typeof message);//string
}
try{
throw 42;
}catch(code){
console.log(code);//42
console.log(typeof code);//number
}
//Not caught exception
try{
//throw new Error("test error");//Error will be thrown. Error: test error
}finally{
}
try{
throw 42;//Error will be thrown. Error: 42
}finally{
console.log('finally');
}