deno/cli/tests/error_022_stack_custom_error.ts

15 lines
233 B
TypeScript

class CustomError extends Error {
constructor() {
super();
this.name = "CustomError";
}
get message(): string {
return "custom error";
}
}
const error = new CustomError();
console.log(error.stack);
throw error;