Skip to content

Commit 0021b95

Browse files
committed
fix(core): make the projector not exit on asset name error
1 parent 8afbd79 commit 0021b95

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/core/src/Asset/NftMetadata/fromMetadatum.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ export const fromMetadatum = (
121121
const assetId = Cardano.AssetId.fromParts(asset.policyId, asset.name);
122122

123123
if (version === '1.0' && !name) {
124-
name = AssetName.toUTF8(asset.name);
124+
try {
125+
name = AssetName.toUTF8(asset.name);
126+
} catch (error) {
127+
logger.warn(error);
128+
}
125129
}
126130

127131
if (!name || !image) {

packages/core/src/Cardano/types/Asset.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ AssetName.toUTF8 = (assetName: AssetName) => {
2222
try {
2323
return utf8Decoder.decode(Buffer.from(assetName, 'hex'));
2424
} catch (error) {
25-
throw new InvalidStringError('Cannot convert AssetName to UTF8', error);
25+
throw new InvalidStringError(`Cannot convert AssetName '${assetName}' to UTF8`, error);
2626
}
2727
};
2828

0 commit comments

Comments
 (0)