Skip to content

Commit 272064a

Browse files
authored
fix: do not retry incorrect clarity values (#143)
* fix: do not retry incorrect clarity values * fix: tests
1 parent be25080 commit 272064a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/token-processor/stacks-node/stacks-node-rpc-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class StacksNodeRpcClient {
128128
if (unwrappedClarityValue.type_id === ClarityTypeID.UInt) {
129129
return unwrappedClarityValue;
130130
}
131-
throw new RetryableJobError(
131+
throw new Error(
132132
`Unexpected Clarity type '${unwrappedClarityValue.type_id}' while unwrapping uint`
133133
);
134134
}
@@ -143,7 +143,7 @@ export class StacksNodeRpcClient {
143143
} else if (unwrappedClarityValue.type_id === ClarityTypeID.OptionalNone) {
144144
return undefined;
145145
}
146-
throw new RetryableJobError(
146+
throw new Error(
147147
`Unexpected Clarity type '${unwrappedClarityValue.type_id}' while unwrapping string`
148148
);
149149
}

tests/stacks-node-rpc-client.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe('StacksNodeRpcClient', () => {
113113
}
114114
});
115115

116-
test('clarity value parse errors get retried', async () => {
116+
test('clarity value parse errors are not retried', async () => {
117117
const mockResponse = {
118118
okay: true,
119119
result: cvToHex(uintCV(5)), // `get-token-uri` will fail because this is a `uint`
@@ -129,9 +129,7 @@ describe('StacksNodeRpcClient', () => {
129129
.reply(200, mockResponse);
130130
setGlobalDispatcher(agent);
131131

132-
await expect(client.readStringFromContract('get-token-uri', [])).rejects.toThrow(
133-
RetryableJobError
134-
);
132+
await expect(client.readStringFromContract('get-token-uri', [])).rejects.toThrow(Error);
135133
});
136134

137135
test('incorrect none uri strings are parsed as undefined', async () => {

0 commit comments

Comments
 (0)