In ES6:
class MyError extends Error {
constructor(message) {
super(message);
this.name="MyError";
}
}
More Related Contents:
- Is it not possible to stringify an Error using JSON.stringify?
- What’s the cause of the error ‘getaddrinfo EAI_AGAIN’?
- Cryptic “Script Error.” reported in Javascript in Chrome and Firefox
- Should a Promise.reject message be wrapped in Error?
- How do I create a custom Error in JavaScript?
- Logging Clientside JavaScript Errors on Server [closed]
- JavaScript Exception Handling
- Is it possible to catch exceptions thrown in a JavaScript async callback?
- alias to chrome console.log
- Catch all JavaScript errors and send them to server [closed]
- Check if localStorage is available
- How do I handle errors with promises?
- Throwing an Error in jQuery’s Deferred object
- Strange Unexpected token ILLEGAL in JavaScript [closed]
- In Javascript, is it expensive to use try-catch blocks even if an exception is never thrown?
- Handling specific errors in JavaScript (think exceptions)
- Why couldn’t popular JavaScript runtimes handle synchronous-looking asynchronous script?
- Custom exception type
- Node.js catch ENOMEM error thrown after spawn
- Javascript exception stack trace
- What is the difference between `throw new Error` and `throw someObject`?
- throw Error(‘msg’) vs throw new Error(‘msg’)
- Axios. How to get error response even when api return 404 error, in try catch finally
- image.onError event never fires, but image isn’t valid data – need a work around
- How can I handle errors in loading an iframe?
- Javascript Asynchronous Exception Handling with node.js
- How to check for broken images in React JS
- How to catch net::ERR_CONNECTION_REFUSED
- How to handle ETIMEDOUT error?
- Why doesn’t the try catch block catch the promise exception?