Skip to content

Commit a46a8b0

Browse files
authored
Merge pull request #89 from JustaName-id/staging
Staging
2 parents 2c43924 + 86acd33 commit a46a8b0

File tree

6 files changed

+298
-227
lines changed

6 files changed

+298
-227
lines changed

apps/vc-api/src/api/filters/vc.api.filters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { CredentialsExceptionFilter } from './credentials/credentials.filter';
66
import { AuthenticationExceptionFilter } from './auth/authentication.filter';
77
import { JustaNameInitializerExceptionFilter } from './auth/justaName-intializer.filter';
88
import { Web3ProviderExceptionFilter } from './web3-provider/web3-provider.filter';
9+
import { RecordsFetchingExceptionFilter } from './verify-records/records-fetching.filter';
910

1011
export const VCManagementApiFilters = [
1112
OTPExceptionFilter,
@@ -16,4 +17,5 @@ export const VCManagementApiFilters = [
1617
CredentialsExceptionFilter,
1718
SocialResolverNotFoundExceptionFilter,
1819
Web3ProviderExceptionFilter,
20+
RecordsFetchingExceptionFilter,
1921
];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { BaseExceptionFilter } from '@nestjs/core';
2+
import { ArgumentsHost, Catch, HttpStatus } from '@nestjs/common';
3+
import { RecordsFetchingException } from '../../../core/domain/exceptions/RecordsFetching.exception';
4+
5+
@Catch(RecordsFetchingException)
6+
export class RecordsFetchingExceptionFilter extends BaseExceptionFilter {
7+
catch(exception: RecordsFetchingException, host: ArgumentsHost) {
8+
const context = host.switchToHttp();
9+
const response = context.getResponse();
10+
const httpStatus = HttpStatus.BAD_REQUEST;
11+
12+
response.status(httpStatus).json({
13+
message: exception.message,
14+
});
15+
}
16+
}

apps/vc-api/src/core/applications/verify-records/isubname-records.fetcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { Subname } from '../../domain/entities/subname';
44
export const SUBNAME_RECORDS_FETCHER = 'SUBNAME_RECORDS_FETCHER';
55

66
export interface ISubnameRecordsFetcher {
7-
fetchRecords(providerUrl: string, subname: string, chainId: ChainId, texts?: string[]): Promise<Subname>;
8-
fetchRecordsFromManySubnames(providerUrl: string, subnames: string[], chainId: ChainId, texts?: string[]): Promise<Subname[]>
7+
fetchRecords(providerUrl: string, subname: string, chainId: ChainId, texts: string[]): Promise<Subname>;
8+
fetchRecordsFromManySubnames(providerUrl: string, subnames: string[], chainId: ChainId, texts: string[]): Promise<Subname[]>
99
}

0 commit comments

Comments
 (0)