1export class UnexpectedError extends Error {
2  readonly name = 'UnexpectedError';
3
4  constructor(message: string) {
5    super(`${message}\nPlease report this as an issue on https://github.com/expo/expo-cli/issues`);
6  }
7}
8
9export type PluginErrorCode =
10  | 'INVALID_PLUGIN_TYPE'
11  | 'INVALID_PLUGIN_IMPORT'
12  | 'PLUGIN_NOT_FOUND'
13  | 'CONFLICTING_PROVIDER'
14  | 'INVALID_MOD_ORDER'
15  | 'MISSING_PROVIDER';
16
17/**
18 * Based on `JsonFileError` from `@expo/json-file`
19 */
20export class PluginError extends Error {
21  readonly name = 'PluginError';
22  readonly isPluginError = true;
23
24  constructor(message: string, public code: PluginErrorCode, public cause?: Error) {
25    super(cause ? `${message}\n└─ Cause: ${cause.name}: ${cause.message}` : message);
26  }
27}
28