Skip to content

Commit 3967cb3

Browse files
committed
feat(cardano-services): increase details in asset not found error
1 parent d64543f commit 3967cb3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/cardano-services/src/Asset/DbSyncAssetProvider/DbSyncAssetProvider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ export class DbSyncAssetProvider extends DbSyncProvider() implements AssetProvid
132132
const multiAsset = await this.#builder.queryMultiAsset(policyId, name);
133133

134134
if (!multiAsset)
135-
throw new ProviderError(ProviderFailure.NotFound, undefined, 'No entries found in multi_asset table');
135+
throw new ProviderError(
136+
ProviderFailure.NotFound,
137+
undefined,
138+
`No entries found in multi_asset table for asset '${assetId}'`
139+
);
136140

137141
const fingerprint = multiAsset.fingerprint as unknown as Cardano.AssetFingerprint;
138142
const supply = BigInt(multiAsset.sum);

packages/cardano-services/test/Asset/DbSyncAssetProvider.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ describe('DbSyncAssetProvider', () => {
7373
});
7474
it('rejects for not found assetId', async () => {
7575
await expect(provider.getAsset({ assetId: notValidAssetId })).rejects.toThrow(
76-
new ProviderError(ProviderFailure.NotFound, undefined, 'No entries found in multi_asset table')
76+
new ProviderError(
77+
ProviderFailure.NotFound,
78+
undefined,
79+
"No entries found in multi_asset table for asset '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'"
80+
)
7781
);
7882
});
7983
it('returns an AssetInfo without extra data', async () => {

0 commit comments

Comments
 (0)