sample custom error with javascript
//Test Error
function OError(message, type) {
this.message = message;
this.type = type;
}
function foo(){
throw new OError("Wrong Function", "List Error");
}
try {
console.log(foo());
} catch(err){
console.log(err.type, err.message);
}
//List Error Wrong Function