Skip to content

Instantly share code, notes, and snippets.

@oleersoy
Created March 7, 2019 15:50
Show Gist options
  • Select an option

  • Save oleersoy/19051447ea2ea59bcaa41fae71514e36 to your computer and use it in GitHub Desktop.

Select an option

Save oleersoy/19051447ea2ea59bcaa41fae71514e36 to your computer and use it in GitHub Desktop.
Is Error
/**
* @param message The error message
* @param value The value that violates the constraint
* @param field The name of the field
* @param type The expected type for the field
* @param constraint The name of the constraint violated
* @param code The application or module code for the error
*/
export class IsError extends Error {
constructor(
public message:string,
public value: any,
public field?:string,
public type?: string,
public constraint?: string,
public code?:string) {
super(message);
this.name = 'IsError';
Object.setPrototypeOf(this, IsError.prototype);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment