Skip to content

Commit

Permalink
Show error while having an issue when parsing the arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
wkwiatek committed Jul 24, 2024
1 parent 3d3be9c commit 3ed6127
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function App() {
<TableHead>Instruction Name</TableHead>
<TableHead>Instruction Gas</TableHead>
<TableHead>Instruction Args</TableHead>
<TableHead>Instruction Errors</TableHead>
</TableRow>
</TableHeader>
<TableBody>
Expand All @@ -141,6 +142,7 @@ function App() {
<TableCell>{programRow.name}</TableCell>
<TableCell>{programRow.gas}</TableCell>
<TableCell>{JSON.stringify(programRow.args)}</TableCell>
<TableCell>{programRow.error}</TableCell>
</TableRow>
))}
</TableBody>
Expand Down
10 changes: 9 additions & 1 deletion src/pvm-packages/pvm/pvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,15 @@ export class Pvm {
if (this.gas < 0) {
// TODO [MaSi]: to handle
}
const args = this.argsDecoder.getArgs(this.pc);

let args;

try {
args = this.argsDecoder.getArgs(this.pc);
} catch (e) {
printableProgram.push({ instructionCode: currentInstruction, ...byteToOpCodeMap[currentInstruction], error: "Cannot get arguments from args decoder" });
return printableProgram;
}

const currentInstructionDebug = { instructionCode: currentInstruction, ...byteToOpCodeMap[currentInstruction], args };

Expand Down

0 comments on commit 3ed6127

Please sign in to comment.