UNPKG

386 BPlain TextView Raw
1/**
2 * A general error class that should be used for all errors in Expo modules.
3 * Guarantees a `code` field that can be used to differentiate between different
4 * types of errors without further subclassing Error.
5 */
6export class CodedError extends Error {
7 code: string;
8 info?: any;
9
10 constructor(code: string, message: string) {
11 super(message);
12 this.code = code;
13 }
14}