-
-
Save brigand/f9912df68a474a84f521d740cbaf0811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyError extends Error { | |
constructor(msg, cause) { | |
super(msg); | |
this.cause = cause; | |
} | |
toJSON() { | |
return { | |
type: 'MyError', | |
message: this.message, | |
cause: this.cause, | |
}; | |
} | |
} | |
throw new MyError('higher level message', fileReadError); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment