File size: 573 Bytes
a271c58 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import { ExceptionFilter, Catch, ArgumentsHost } from '@nestjs/common';
import { Response } from 'express';
import { NotEnoughScopes } from '@gitroom/nestjs-libraries/integrations/social.abstract';
import { HttpStatusCode } from 'axios';
@Catch(NotEnoughScopes)
export class NotEnoughScopesFilter implements ExceptionFilter {
catch(exception: NotEnoughScopes, host: ArgumentsHost) {
const ctx = host.switchToHttp();
const response = ctx.getResponse<Response>();
response
.status(HttpStatusCode.Conflict)
.json({ msg: exception.message });
}
}
|