diff --git a/src/confidential-transactions/confidential-transactions.service.spec.ts b/src/confidential-transactions/confidential-transactions.service.spec.ts index 0904c624..2ed29d64 100644 --- a/src/confidential-transactions/confidential-transactions.service.spec.ts +++ b/src/confidential-transactions/confidential-transactions.service.spec.ts @@ -117,7 +117,10 @@ describe('ConfidentialTransactionsService', () => { await expect(() => service.findOne(id)).rejects.toThrowError(); - expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError); + expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError, { + id: id.toString(), + resource: 'Confidential Transaction', + }); }); }); diff --git a/src/transactions/transactions.util.spec.ts b/src/transactions/transactions.util.spec.ts index 5919c05b..ee589130 100644 --- a/src/transactions/transactions.util.spec.ts +++ b/src/transactions/transactions.util.spec.ts @@ -228,4 +228,14 @@ describe('handleSdkError', () => { expect(error).toBeInstanceOf(expectedError); }); }); + it('should return AppNotFoundError with resource specific info', () => { + const inputError = new PolymeshError({ code: ErrorCode.DataUnavailable, message: '' }); + when(mockIsPolymeshError).calledWith(inputError).mockReturnValue(true); + const error = handleSdkError(inputError, { id: '1', resource: 'Example Resource' }); + + expect(error).toBeInstanceOf(AppNotFoundError); + expect(error.message).toEqual( + 'Not Found: Example Resource was not found: with identifier: "1"' + ); + }); });