Skip to content

Commit

Permalink
Use StringValueInfoToStringLossy function in debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
haltman-at committed May 12, 2023
1 parent 9230d72 commit 39c9922
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions packages/debugger/lib/stacktrace/selectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,19 +332,10 @@ let stacktrace = createSelectorTree({
switch (decoding.abi.name) {
case "Error":
const revertStringInfo = decoding.arguments[0].value.value;
switch (revertStringInfo.kind) {
case "valid":
return { Error: revertStringInfo.asString };
case "malformed":
//turn into a JS string while smoothing over invalid UTF-8
//slice 2 to remove 0x prefix
return {
Error: Buffer.from(
revertStringInfo.asHex.slice(2),
"hex"
).toString()
};
}
return {
Error:
Codec.Export.stringValueInfoToStringLossy(revertStringInfo)
};
case "Panic":
const panicCode = decoding.arguments[0].value.value.asBN;
return { Panic: panicCode };
Expand Down

0 comments on commit 39c9922

Please sign in to comment.