Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nicohrubec committed Jul 11, 2024
1 parent 01d96a3 commit d1a3531
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export class TestException extends Error {
constructor() {
super("Something went wrong in the test module!");
super('Something went wrong in the test module!');
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ArgumentsHost, BadRequestException, Catch } from '@nestjs/common';
import { TestException } from './test.exception';
import { BaseExceptionFilter } from '@nestjs/core';
import { TestException } from './test.exception';

@Catch(TestException)
export class TestExceptionFilter extends BaseExceptionFilter {
catch (exception: unknown, host: ArgumentsHost) {
catch(exception: unknown, host: ArgumentsHost) {
if (exception instanceof TestException) {
return super.catch(new BadRequestException(exception.message), host);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Module } from '@nestjs/common';
import { TestController } from './test.controller';
import { APP_FILTER } from '@nestjs/core';
import { TestController } from './test.controller';
import { TestExceptionFilter } from './test.filter';

@Module({
Expand All @@ -10,7 +10,7 @@ import { TestExceptionFilter } from './test.filter';
{
provide: APP_FILTER,
useClass: TestExceptionFilter,
}
]
},
],
})
export class TestModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test('Does not send expected exception to Sentry', async ({ baseURL }) => {
test('Does not handle expected exception if exception is thrown in module', async ({ baseURL }) => {
const errorEventPromise = waitForError('nestjs', event => {
return !event.type && event.exception?.values?.[0]?.value === 'Something went wrong in the test module!';
})
});

const response = await fetch(`${baseURL}/test-module`);
expect(response.status).toBe(500); // should be 400
Expand Down

0 comments on commit d1a3531

Please sign in to comment.