Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/vc-api/src/api/filters/vc.api.filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CredentialsExceptionFilter } from './credentials/credentials.filter';
import { AuthenticationExceptionFilter } from './auth/authentication.filter';
import { JustaNameInitializerExceptionFilter } from './auth/justaName-intializer.filter';
import { Web3ProviderExceptionFilter } from './web3-provider/web3-provider.filter';
import { RecordsFetchingExceptionFilter } from './verify-records/records-fetching.filter';

export const VCManagementApiFilters = [
OTPExceptionFilter,
Expand All @@ -16,4 +17,5 @@ export const VCManagementApiFilters = [
CredentialsExceptionFilter,
SocialResolverNotFoundExceptionFilter,
Web3ProviderExceptionFilter,
RecordsFetchingExceptionFilter,
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { BaseExceptionFilter } from '@nestjs/core';
import { ArgumentsHost, Catch, HttpStatus } from '@nestjs/common';
import { RecordsFetchingException } from '../../../core/domain/exceptions/RecordsFetching.exception';

@Catch(RecordsFetchingException)
export class RecordsFetchingExceptionFilter extends BaseExceptionFilter {
catch(exception: RecordsFetchingException, host: ArgumentsHost) {
const context = host.switchToHttp();
const response = context.getResponse();
const httpStatus = HttpStatus.BAD_REQUEST;

response.status(httpStatus).json({
message: exception.message,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { Subname } from '../../domain/entities/subname';
export const SUBNAME_RECORDS_FETCHER = 'SUBNAME_RECORDS_FETCHER';

export interface ISubnameRecordsFetcher {
fetchRecords(providerUrl: string, subname: string, chainId: ChainId, texts?: string[]): Promise<Subname>;
fetchRecordsFromManySubnames(providerUrl: string, subnames: string[], chainId: ChainId, texts?: string[]): Promise<Subname[]>
fetchRecords(providerUrl: string, subname: string, chainId: ChainId, texts: string[]): Promise<Subname>;
fetchRecordsFromManySubnames(providerUrl: string, subnames: string[], chainId: ChainId, texts: string[]): Promise<Subname[]>
}
Loading
Loading