Answers for "throw exception"

38

js throw error

throw new Error('Whoops!')
Posted by: Guest on March-17-2020
2

throw new error(

throw new Exception("Error here");
Posted by: Guest on August-08-2021
8

node js throw error

FactoryController.prototype.create = function (callback) {
    //The throw is working, and the exception is returned.
    throw new Error('An error occurred'); //outside callback 
    try {
        this.check(function (check_result) {
            callback(check_result);
        });
    } catch (ex) {
        throw new Error(ex.toString());
    }
}

FactoryController.prototype.create = function (callback) {
    try {
        this.check(function (check_result) {
            //The throw is not working on this case to return the exception to the caller(parent)
            throw new Error('An error occurred'); //inside callback 
        });
    } catch (ex) {
        throw new Error(ex.toString());
    }
}
Posted by: Guest on May-05-2020
1

throw new error(

try {
  throw new Error('yoooooooo!')
} catch (e) {
  console.error(e)
}
Posted by: Guest on October-21-2021
1

throw new error(

try {
  throw new Error('Whoops!')
} catch (e) {
  console.error(e.name + ': ' + e.message)
}
Posted by: Guest on July-26-2021
1

throw new error(

try{
throw new Error ('Whoops!)
}catch (e) {
 console.log(e.name + ':' + e.message
Posted by: Guest on September-21-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language