15 lines
675 B
TypeScript
15 lines
675 B
TypeScript
export type PluginErrorReason = 'INVALID_CONFIG' | 'ALREADY_INSTALLED' | 'NOT_INSTALLED'
|
|
| 'MANAGER_DISPOSED' | 'LOAD_FAILED' | 'INIT_FAILED' | 'DISPOSE_FAILED';
|
|
|
|
export class PluginError extends Error {
|
|
constructor(readonly reason: PluginErrorReason) {
|
|
super({
|
|
INVALID_CONFIG: 'Invalid plugin config', ALREADY_INSTALLED: 'Duplicate plugin',
|
|
NOT_INSTALLED: 'Plugin not installed', MANAGER_DISPOSED: 'Plugin manager disposed',
|
|
LOAD_FAILED: 'Plugin load failed', INIT_FAILED: 'Plugin initialization failed',
|
|
DISPOSE_FAILED: 'Plugin disposal failed',
|
|
}[reason]);
|
|
this.name = 'PluginError';
|
|
}
|
|
}
|