Skip to content

devInspectTransactionBlock does not return readable MoveAbort error messages #482

@svssathvik7

Description

@svssathvik7

I'm using the Sui SDK to dry run a transaction with devInspectTransactionBlock, and while I do receive a MoveAbort error, the actual reason/message is not clearly available in the response. The error object is an instance of Error, and when I try to access or parse the underlying execution error (like MoveAbort code or function), I only get a generic message string.

Here’s a minimal code snippet demonstrating the issue:

try {
  const dryRunResult = await this.client.devInspectTransactionBlock({
    sender: this.htlcActorAddress,
    transactionBlock: tx
  });

  if (dryRunResult.error) {
    throw new Error(`Dry run failed ${dryRunResult.error}`);
  }
} catch (error: any) {
  const match = error.message?.match(/MoveAbort\(.*?\), (\d+)/);
  console.log("error code", match);
  throw new Error(`Failed to dry run initiate transaction`);
}

But when i log the error, I get:

Dry run failed ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(...), code: 7 } }

However, I can't programmatically extract a readable message or explanation of what caused the abort. Logging JSON.stringify(error) gives {}, and the .message is just a string.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions