Fix token not being refreshed (#1975)
* Fix token not being refreshed * Fix token not being refreshed * v2 * Fix
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Catch, HttpException } from '@nestjs/common';
|
||||
import { Catch, UnauthorizedException } from '@nestjs/common';
|
||||
import { GqlExceptionFilter } from '@nestjs/graphql';
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
@ -6,7 +6,7 @@ import { GraphQLError } from 'graphql';
|
||||
|
||||
@Catch()
|
||||
export class ExceptionFilter implements GqlExceptionFilter {
|
||||
catch(exception: HttpException) {
|
||||
catch(exception: Error) {
|
||||
if (exception instanceof Prisma.PrismaClientValidationError) {
|
||||
throw new GraphQLError('Invalid request', {
|
||||
extensions: {
|
||||
@ -14,6 +14,14 @@ export class ExceptionFilter implements GqlExceptionFilter {
|
||||
},
|
||||
});
|
||||
}
|
||||
if (exception instanceof UnauthorizedException) {
|
||||
throw new GraphQLError('Unauthorized', {
|
||||
extensions: {
|
||||
code: 'UNAUTHENTICATED',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user