postio / libraries /nestjs-libraries /src /integrations /integration.missing.scopes.ts
Leon4gr45's picture
Upload folder using huggingface_hub (part 10)
a271c58 verified
Raw
History Blame Contribute Delete
573 Bytes
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 });
}
}