penisularhr / src / exceptions / user.exception.ts
user.exception.ts
Raw
import { BadRequestException, NotFoundException } from '@nestjs/common';

export class UserNotFoundException extends NotFoundException {
  constructor(error?: string) {
    super('User not found', error);
  }
}

export class IncorrectCredentialException extends BadRequestException {
  constructor(error?: string) {
    super('Incorrect username or password', error);
  }
}

export class UserIsAdminException extends BadRequestException {
  constructor(error?: string) {
    super('User is admin', error);
  }
}
export class UserIsImmutableException extends BadRequestException {
  constructor(error?: string) {
    super('This user is immutable', error);
  }
}