Skip to content

Commit

Permalink
Merge pull request #88 from JustaName-id/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Ghadi8 authored Dec 13, 2024
2 parents fc224ef + 39128cd commit 86acd33
Show file tree
Hide file tree
Showing 6 changed files with 298 additions and 227 deletions.
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

0 comments on commit 86acd33

Please sign in to comment.