Skip to content

Commit

Permalink
feat: custom exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aniebietafia committed Sep 1, 2024
1 parent 924627a commit 519b178
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion brints-estate-api/src/auth/providers/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
generateVerificationToken,
} from 'src/utils/generate-token.lib';
import { VerificationStatus } from 'src/enums/roles.model';
import { CustomConflictException } from 'src/exceptions/http-exception.filter';
import { CustomConflictException } from 'src/exceptions/custom.exception';

@Injectable()
export class AuthService {
Expand Down
7 changes: 7 additions & 0 deletions brints-estate-api/src/exceptions/custom.exception.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { HttpException, HttpStatus } from '@nestjs/common';

export class CustomConflictException extends HttpException {
constructor(status_code: HttpStatus, message: string) {
super(message, status_code);
}
}
7 changes: 0 additions & 7 deletions brints-estate-api/src/exceptions/http-exception.filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ import {
Catch,
ExceptionFilter,
HttpException,
HttpStatus,
} from '@nestjs/common';
import { Response } from 'express';

export class CustomConflictException extends HttpException {
constructor(status_code: HttpStatus, message: string) {
super(message, status_code);
}
}

@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
catch(exception: HttpException, host: ArgumentsHost) {
Expand Down

0 comments on commit 519b178

Please sign in to comment.