-
Notifications
You must be signed in to change notification settings - Fork 149
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
UI and python client get the error types and error docs from metadata #384
Comments
Synced with the @opentensor/cortex peeps, this is how we will pass it to them: We will add an RPC call that produces a JSON map of all error codes => { name, description } for each error. Client will hold off on calling this RPC endpoint until the first time they encounter an error, then they will hit the endpoint and cache the map (probably in a local file). Later, if they ever hit an error code that isn't in their local map, they will hit the endpoint again. In this way, we will always be able to display names and descriptions for errors coming from subtensor, even if new ones are introduced in a chain upgrade that bittensor doesn't specifically know about. cc @unconst ^ so data coming back from that endpoint will look something like: {
"0": {
"name": "SomeError",
"description": "Thrown when yeet and something something"
},
"1": {
"name": "AnotherError",
"description": "This is a description something something"
},
"2": {
"name": "YetAnotherError",
"description": "This is a description something something"
}
} |
I would recommend doing something like this rather than pub trait SubtensorError {
const NAME: &'static str;
const DESCRIPTION: &'static str;
} |
Related : #375 cc @camfairchild |
partially fixed by #391 |
right now it looks like the way forward is actually just using regular substrate metadata, which @open-junius has implemented in #391 |
From this unit test file for metadata, the structure is clear for other language like python to parse. |
It's pretty annoying that the UI doesn't know at all what errors are if they haven't been hard-coded. Unknown error isn't a great user experience, and right now introducing new error types or errors in new situations creates a lot of churn with releases.
Substrate provides the metadata, which includes all info about errors, calls and events.
At first, we must guarantee all of them are well documented. In this issue, all docs for errors are checked.
From this unit test file for metadata check, the structure is clear for other language like python and js to parse.
https://github.com/opentensor/subtensor/blob/development/runtime/tests/metadata.rs
fixes #375
The text was updated successfully, but these errors were encountered: