Error Handing Examples

by Joshua McNeese

JavaScript

function exceptionThrower() {
        
    throw {
        name: "ExceptionThrowerException",
        message: "Bad things afoot"
    };
    
    //throw new Error("Bad things afoot");
}

try {
    exceptionThrower();
} catch (e) {
    console.log(e);
} finally {
     console.log("Finally...");   
}