TypeScript
Exception naming

by Benny Neugebauer

class UserIsUnknownError extends UserError {
  constructor(
    message: string,
    label: BackendErrorLabel = BackendErrorLabel.CLIENT_ERROR,
    code: StatusCode = StatusCode.BAD_REQUEST
  ) {
    super(message, label, code);
    Object.setPrototypeOf(this, UserIsUnknownError.prototype);
    this.name = 'UserIsUnknownError';
  }
}

class UnknownUserError extends UserError {
  constructor(
    message: string,
    label: BackendErrorLabel = BackendErrorLabel.CLIENT_ERROR,
    code: StatusCode = StatusCode.BAD_REQUEST
  ) {
    super(message, label, code);
    Object.setPrototypeOf(this, UnknownUserError.prototype);
    this.name = 'UnknownUserError';
  }
}