Skip to content

feat(jsonrpc): jsonrpc set error resolver #6369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: release_v4.8.1
Choose a base branch
from

Conversation

0xbigapple
Copy link

@0xbigapple 0xbigapple commented Jun 30, 2025

What does this PR do?
Support setting of data field when jsonrpc return error, from #6330
Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@0xbigapple 0xbigapple changed the title feat(jsonrpc)jsonrpc set tron error resolver feat(jsonrpc): jsonrpc set tron error resolver Jun 30, 2025
@0xbigapple 0xbigapple changed the title feat(jsonrpc): jsonrpc set tron error resolver feat(jsonrpc): jsonrpc set error resolver Jun 30, 2025
@kuny0707 kuny0707 moved this to In Review in java-tron Jun 30, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just modify JsonRpcInternalException itself?
Do not modify TronException.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just modify JsonRpcInternalException itself? Do not modify TronException.

Thank you for your suggestion. I have added a JsonRpcException as the parent class for JSON-RPC exceptions, which makes it easier to extend the data field for all JSON-RPC exceptions. d575241

@0xbigapple
Copy link
Author

Like eth_call, the eth_estimateGas interface can also set the data field when a contract execution exception occurs. I have supported this feature in the commit 694445b.


@Getter
public class JsonRpcException extends TronException {
private Object data = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not define data's type as byte[] ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object is more general than byte[], I think

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, use the Object type because it is more flexible and can support various kinds of data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

eth_call does not return data like the triggerconstantcontract interface does
7 participants