REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.28 KB
Close
/home/byroehnu/easepay.easetack.com/node_modules/adminjs/src/backend/services/action-error-handler/action-error-handler.ts
Text
Base64
import { NoticeMessage } from '../../../index.js' import { ActionContext, BulkActionResponse, RecordActionResponse } from '../../actions/action.interface.js' import AppError from '../../utils/errors/app-error.js' import ForbiddenError from '../../utils/errors/forbidden-error.js' import NotFoundError from '../../utils/errors/not-found-error.js' import RecordError from '../../utils/errors/record-error.js' import ValidationError, { PropertyErrors } from '../../utils/errors/validation-error.js' /** * @private * @classdesc * Function which catches all the errors thrown by the action hooks or handler */ const actionErrorHandler = ( error: Error, context: ActionContext, ): RecordActionResponse | BulkActionResponse => { if ( error instanceof ValidationError || error instanceof ForbiddenError || error instanceof NotFoundError || error instanceof AppError ) { const { record, currentAdmin, action } = context const baseError: RecordError | null = error.baseError ?? null let baseMessage = '' let errors: PropertyErrors = {} let meta: any let notice: NoticeMessage if (error instanceof ValidationError) { baseMessage = error.baseError?.message || 'thereWereValidationErrors' errors = error.propertyErrors } else { // ForbiddenError, NotFoundError, AppError baseMessage = error.baseMessage || 'anyForbiddenError' } // Add required meta data for the list action if (action.name === 'list') { meta = { total: 0, perPage: 0, page: 0, direction: null, sortBy: null, } } const recordJson = record?.toJSON?.(currentAdmin) if (error instanceof ForbiddenError && recordJson) { recordJson.params = {} recordJson.title = '' recordJson.populated = {} } notice = { message: baseMessage, type: 'error', } if (error instanceof AppError && error.notice) { notice = { ...notice, ...error.notice, } } return { record: { ...recordJson, params: recordJson?.params ?? {}, populated: recordJson?.populated ?? {}, baseError, errors, }, records: [], notice, meta, } } throw error } export default actionErrorHandler
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.htaccess
127 B
lr--r--r--
2026-03-14 01:49:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
action-error-handler.spec.ts
3.78 KB
lrw-r--r--
2026-02-28 00:31:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
action-error-handler.ts
2.28 KB
lrw-r--r--
2026-02-28 00:31:58
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.ts
74 B
lrw-r--r--
2026-02-28 00:32:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).