You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say we got a consumer which applies middleware X for certain routes.. If we throw an exception in that middleware X (or pass the exception in the next/done function as new SampleException(...)), we receive a response of "[object Object]" which is really strange..
Expected behavior
@nestjs/common 4.5.9, @nestjs/core 4.5.10, @nestjs/microservices 4.5.8, @nestjs/testing 4.5.5, @nestjs/websockets 4.5.8 => with these versions it works properly - instead of "[object Object]", the proper exception is returned
Minimal reproduction of the problem with instructions
@controller('api')
export class SampleController { @get('something')
getSomething() {}
}
I'm submitting a...
[ ] Regression
Current behavior
Let's say we got a consumer which applies middleware X for certain routes.. If we throw an exception in that middleware X (or pass the exception in the next/done function as new SampleException(...)), we receive a response of "[object Object]" which is really strange..
Expected behavior
@nestjs/common 4.5.9, @nestjs/core 4.5.10, @nestjs/microservices 4.5.8, @nestjs/testing 4.5.5, @nestjs/websockets 4.5.8 => with these versions it works properly - instead of "[object Object]", the proper exception is returned
Minimal reproduction of the problem with instructions
@controller('api')
export class SampleController {
@get('something')
getSomething() {}
}
const middleware = (req: Request, res: Response, next: NextFunction) => {
next(new UnauthorizedException('Invalid credentials'));
}
@module({
controllers: [SampleController]
})
export class SampleModule {
configure(consumer: MiddlewaresConsumer) {
consumer.apply(middleware).forRoutes({path: 'api/getSomething', method: RequestMethod.Get})
}
}
Current behaviour:
GET /api/getSomething => [object Object] // [object Object] also gets logged in the server console
Expected behaviour (how it used to work):
GET /api/getSomething => {error: 'Unauthorized', message: 'Invalid credentials', status: 401}
The text was updated successfully, but these errors were encountered: