import { HttpStatus } from '@nestjs/common'; import { ApiException } from '../common/exceptions/api.exception'; export class AuthException extends ApiException { readonly challenge: string; constructor(scheme: 'Basic' | 'Bearer') { super( HttpStatus.UNAUTHORIZED, 'unauthorized', 'Требуется действительная аутентификация', ); this.challenge = scheme === 'Basic' ? 'Basic realm="messenger", charset="UTF-8"' : 'Bearer realm="messenger"'; } }