-
Notifications
You must be signed in to change notification settings - Fork 103
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
feat(jsonrpc): add error data field from JSON RPC spec #483
Conversation
@xJonathanLEI changed this one to also add the data error when the error is a more generic one and not only starknet contract error. |
When you say there's a This PR shouldn't be merged at least until we move to v0.5.x. |
You're totally right for the CONTRACT_ERROR variant. And the we shouldn't add the data behavior on this specific error until v0.5.x. However the PR also addresses the JSON RPC spec, where the error object contains a data field that we are not using as it can be omitted but can also be present following the spec. https://www.jsonrpc.org/specification#error_object Can we please consider this part of the PR and I remove the CONTRACT_ERROR part? |
I Will rename and and change the context accordingly to have a better scope on this PR. |
@xJonathanLEI I've changed the PR to only address the compatibility with the JSON RPC spec (not the JSON RPC of starknet, but the underlying protocol). WDYT? |
As much as I agree that we definitely need the ability to parse the |
Superseded by #513. |
Currently, when the JSON RPC error is
ContractError(40)
, we loose thedata
field that is only present for theCONTRACT_ERROR
error type from the spec.This PR aims at adding the
revert_error
that is present indata
to the error message.I've tried to modified the structure, but due to the current state of the spec, @xJonathanLEI do you think that is enough, or we should prepare a struct that can be forward compatible with other possible error coming in the future?
In anyway, it's useful to have a more explicit error message in the case of contract error. We may add a
revert_reason
field?Any comment feedback very welcomed!