-
-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: nullish reference in
getNodeError
(#2769)
* Fix null pointer exception in getNodeError check for ExecutionRevertedError * Update khaki-onions-teach.md --------- Co-authored-by: Nguyen Anh Tu <[email protected]> Co-authored-by: jxom <[email protected]>
- Loading branch information
1 parent
183811c
commit ed22d38
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"viem": patch | ||
--- | ||
|
||
Fixed undefined reference in `getNodeError`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,6 +297,23 @@ test('ExecutionRevertedError', () => { | |
`) | ||
}) | ||
|
||
test('UnknownNodeError check with null cause in error chain', () => { | ||
const error = new TransactionRejectedRpcError( | ||
new Error('null cause', { cause: null }), | ||
) | ||
const result = getNodeError(error, { | ||
account: address.vitalik, | ||
maxFeePerGas: parseGwei('10'), | ||
maxPriorityFeePerGas: parseGwei('11'), | ||
}) | ||
expect(result).toMatchInlineSnapshot(` | ||
[UnknownNodeError: An error occurred while executing: Transaction creation failed. | ||
Details: null cause | ||
Version: [email protected]] | ||
`) | ||
}) | ||
|
||
test('Unknown node error', () => { | ||
const error = new TransactionRejectedRpcError( | ||
new RpcRequestError({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters