Skip to content

Instantly share code, notes, and snippets.

@Janoyan
Created December 6, 2020 14:05
Show Gist options
  • Save Janoyan/0b037a0430157055625f082bbb6ae2a1 to your computer and use it in GitHub Desktop.
Save Janoyan/0b037a0430157055625f082bbb6ae2a1 to your computer and use it in GitHub Desktop.
import { ErrorData } from './ErrorData';
abstract class BaseError extends Error {
code: number;
slug: string;
constructor(code: number, message: string, slug: string) {
super(message);
this.code = code;
this.slug = slug;
Object.setPrototypeOf(this, new.target.prototype);
}
abstract getErrorData(): ErrorData;
}
export default BaseError;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment