mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-17 21:49:36 +02:00
24 lines
667 B
TypeScript
24 lines
667 B
TypeScript
import { BaseError, type BaseErrorOptions } from './base.error';
|
||
|
||
export type UserErrorOptions = Omit<BaseErrorOptions, 'level'> & {
|
||
level?: 'info' | 'warning';
|
||
description?: string | null | undefined;
|
||
};
|
||
|
||
/**
|
||
* Error that indicates the user performed an action that caused an error.
|
||
* E.g. provided invalid input, tried to access a resource they’re not
|
||
* authorized to, or violates a business rule.
|
||
*
|
||
* Default level: info
|
||
*/
|
||
export class UserError extends BaseError {
|
||
declare readonly description: string | null | undefined;
|
||
|
||
constructor(message: string, opts: UserErrorOptions = {}) {
|
||
opts.level = opts.level ?? 'info';
|
||
|
||
super(message, opts);
|
||
}
|
||
}
|