peertube-plugin-livechat/client/common/lib/models/validation.ts

22 lines
508 B
TypeScript
Raw Normal View History

// SPDX-FileCopyrightText: 2024 Mehdi Benadel <https://mehdibenadel.com>
//
// SPDX-License-Identifier: AGPL-3.0-only
export enum ValidationErrorType {
2024-06-06 09:36:07 +00:00
Missing,
WrongType,
WrongFormat,
NotInRange,
2024-06-06 13:03:12 +00:00
Duplicate
}
export class ValidationError extends Error {
properties: {[key: string]: ValidationErrorType[] } = {}
constructor (name: string, message: string | undefined, properties: ValidationError['properties']) {
super(message)
this.name = name
this.properties = properties
}
}