Skip to content

Instantly share code, notes, and snippets.

@oleersoy
Created March 6, 2019 15:24
Show Gist options
  • Select an option

  • Save oleersoy/906207ed8dd12ef371238e3d467d0642 to your computer and use it in GitHub Desktop.

Select an option

Save oleersoy/906207ed8dd12ef371238e3d467d0642 to your computer and use it in GitHub Desktop.
IsError
/**
* @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