diff --git a/src/approval/ApprovalController.ts b/src/approval/ApprovalController.ts index 85442ff751..3be6d4c3b8 100644 --- a/src/approval/ApprovalController.ts +++ b/src/approval/ApprovalController.ts @@ -4,6 +4,7 @@ import { nanoid } from 'nanoid'; import { BaseController, Json } from '../BaseControllerV2'; import type { RestrictedControllerMessenger } from '../ControllerMessenger'; +import { ApprovalRequestNotFoundError } from './errors'; const controllerName = 'ApprovalController'; @@ -568,7 +569,7 @@ export class ApprovalController extends BaseController< private _deleteApprovalAndGetCallbacks(id: string): ApprovalCallbacks { const callbacks = this._approvals.get(id); if (!callbacks) { - throw new Error(`Approval request with id '${id}' not found.`); + throw new ApprovalRequestNotFoundError(id); } this._delete(id); diff --git a/src/approval/errors.ts b/src/approval/errors.ts new file mode 100644 index 0000000000..7389d351b1 --- /dev/null +++ b/src/approval/errors.ts @@ -0,0 +1,5 @@ +export class ApprovalRequestNotFoundError extends Error { + constructor(id: string) { + super(`Approval request with id '${id}' not found.`); + } +} diff --git a/src/approval/index.ts b/src/approval/index.ts new file mode 100644 index 0000000000..40addb379b --- /dev/null +++ b/src/approval/index.ts @@ -0,0 +1,2 @@ +export * from './ApprovalController'; +export * from './errors'; diff --git a/src/index.ts b/src/index.ts index 76df3f28a5..240872deaf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,7 @@ import { formatIconUrlWithProxy } from './assets/assetsUtil'; export * from './assets/AccountTrackerController'; export * from './user/AddressBookController'; -export * from './approval/ApprovalController'; +export * from './approval'; export * from './assets/AssetsContractController'; export * from './BaseController'; export { diff --git a/src/permissions/index.ts b/src/permissions/index.ts index dced5a9ac3..c2097d2fa7 100644 --- a/src/permissions/index.ts +++ b/src/permissions/index.ts @@ -1,4 +1,5 @@ export * from './Caveat'; +export * from './errors'; export * from './Permission'; export * from './PermissionController'; export * from './utils';