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

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

/**
 * Property Errors
 * @alias PropertyErrors
 * @memberof ValidationError
 */
export type PropertyErrors = {
  [key: string]: RecordError;
}

/**
 * Error which is thrown when there are validation errors with records
 * @category Errors
 */
export class ValidationError extends Error {
  /**
   * Validation errors for all properties
   */
  public propertyErrors: PropertyErrors

  /**
   * One root validation error i.e. thrown when user wants to perform
   * an action which violates foreign key constraint
   */
  public baseError: RecordError | null

  /**
   * HTTP Status code: 400
   */
  public statusCode: number

  /**
   * @param {PropertyErrors} propertyErrors     error messages
   * @param {RecordError} [baseError]           base error message
   */
  constructor(propertyErrors: PropertyErrors, baseError?: RecordError) {
    super('Resource cannot be stored because of validation errors')
    this.statusCode = 400
    this.propertyErrors = propertyErrors
    this.baseError = baseError || null
    this.name = ErrorTypeEnum.Validation
  }
}

export default ValidationError

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).