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());
}
}
Error Name Description
EvalError An error in the eval() function has occurred.
RangeError Out of range number value has occurred.
ReferenceError An illegal reference has occurred.
SyntaxError A syntax error within code inside the eval() function has occurred.
All other syntax errors are not caught by try/catch/finally, and will
trigger the default browser error message associated with the error.
To catch actual syntax errors, you may use the onerror event.
TypeError An error in the expected variable type has occurred.
URIError An error when encoding or decoding the URI has occurred
(ie: when calling encodeURI()).
# :::::: - AGREAGAR SUDO, EN CENTOS 7 SERVER - :::::
#creamos el usuario
adduser junior
#creamos el pasword
passwd junior123
#agregamos el permiso de SUDO AL usuario "junior"
usermod -aG wheel junior
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
}
}