abolish
Version:
A javascript object validator.
37 lines (36 loc) • 967 B
TypeScript
/**
* AbolishError
* @class
* This class can be used to return custom errors to the validation process
*/
declare class AbolishError {
message: string;
data?: any;
code: string;
constructor(message: string, data?: any);
/**
* Set code
* @param code - A custom error code
* @returns {this} - Returns the current instance
* @example
* new AbolishError("Invalid value").setCode(data);
*/
setCode(code: string): this;
/**
* Set data
* @param data - A custom data
* @returns {this} - Returns the current instance
* @example
* new AbolishError("Invalid value").setData(data);
*/
setData(data: any): this;
/**
* Set message
* @param message - A custom message
* @returns {this} - Returns the current instance
* @example
* new AbolishError("Invalid value").setMessage(message);
*/
setMessage(message: string): this;
}
export = AbolishError;