Skip to content

Instantly share code, notes, and snippets.

@tmatz
Last active August 20, 2022 16:01
Show Gist options
  • Save tmatz/7a8f8cba88a83b11b0f7247761289060 to your computer and use it in GitHub Desktop.
Save tmatz/7a8f8cba88a83b11b0f7247761289060 to your computer and use it in GitHub Desktop.
javascript CustomError
export class CustomError extends Error {
get name() {
return this.constructor.name
}
}
@tmatz
Copy link
Author

tmatz commented Jun 15, 2022

  • no need to define constructor

@tmatz
Copy link
Author

tmatz commented Aug 20, 2022

It is difficult more than I expected.

see https://github.com/adriengibrat/ts-custom-error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment