PHP 8.2.30
Preview: app-error.ts Size: 1.28 KB
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/src/backend/utils/errors/app-error.ts

import { NoticeMessage } from '../../../index.js'
import { ErrorTypeEnum } from '../../../utils/error-type.enum.js'
import RecordError from './record-error.js'

/**
 * Error which can be thrown by developer in custom actions/hooks/components
 *
 * @category Errors
 */
export class AppError extends Error {
  /**
   * HTTP Status code, defaults to 400
   */
  public statusCode: number

  /**
   * Base error message and type which is stored in the record
   */
  public baseError: RecordError

  /**
   * Any custom message which should be seen in the UI
   */
  public baseMessage?: string

  /**
   * Any additional error information
   */
  public data?: Record<string, unknown>

  /**
   * Any additional notice configuration to show in UI
   */
  public notice?: Partial<NoticeMessage>

  /**
   * @param {string} message    a message to be shared with the client
   * @param {string} data       additional data to be shared with the client
   */
  constructor(message: string, data?: Record<string, unknown>, notice?: Partial<NoticeMessage>) {
    super(message)
    this.statusCode = 400
    this.baseMessage = message
    this.baseError = {
      message,
      type: ErrorTypeEnum.App,
    }
    this.data = data
    this.notice = notice
    this.name = ErrorTypeEnum.App
  }
}

export default AppError

Directory Contents

Dirs: 0 × Files: 8

Name Size Perms Modified Actions
1.28 KB lrw-r--r-- 2026-02-28 00:32:00
Edit Download
783 B lrw-r--r-- 2026-02-28 00:32:02
Edit Download
954 B lrw-r--r-- 2026-02-28 00:32:16
Edit Download
261 B lrw-r--r-- 2026-02-28 00:32:28
Edit Download
1.20 KB lrw-r--r-- 2026-02-28 00:32:38
Edit Download
888 B lrw-r--r-- 2026-02-28 00:32:38
Edit Download
327 B lrw-r--r-- 2026-02-28 00:32:40
Edit Download
1.18 KB lrw-r--r-- 2026-02-28 00:32:46
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).