starknet-specs icon indicating copy to clipboard operation
starknet-specs copied to clipboard

Support exposing contract error reason and not just code and a generic message

Open yoga-braavos opened this issue 11 months ago • 1 comments

Current spec mandates a hardcoded error message on contract errors. This prevents clients from programmatically proess such errors: https://github.com/starkware-libs/starknet-specs/blob/cddef47e2f239c032f2b057217bcd2d1f176b4b0/api/starknet_api_openrpc.json#L3597

We need to add to the spec the actual contract error so that clients will have programmatic access to this info

yoga-braavos avatar Sep 18 '23 21:09 yoga-braavos

You can try updating the API Specification: Open the starknet_api_openrpc.json file at line 3597 and add the necessary details for the contract error. You should update the "CONTRACT_ERROR" section to include fields that provide programmatic access to the error information.

For example:

json Copy code "CONTRACT_ERROR": { "type": "object", "properties": { "code": { "type": "integer", "description": "Error code for the contract error." }, "message": { "type": "string", "description": "Error message for the contract error." }, // Add other relevant fields as needed }, "description": "Details of a contract error." }, Make sure to customize this based on the specific information you want to provide for contract errors.

Cevedale avatar Nov 10 '23 11:11 Cevedale