Currently, we utilize basic strings for errors, wrapping them within the various languages we have software in (JavaScript & AssemblyScript Error structure, Rust's Err structure, etc).
In the same way that we have standardized structures for the various cross-module operations we support (invoke & subinvoke for example), we should have a standardize error structure that is used.
Information within this structure would include:
- Error Message
- Source-map Info (file, line, column)
- URI
- Sub-Errors
Utilizing this information, we can re-create an error-stack, enabling them to further debug where the root cause came from.
Currently we do this through string concatenation & "good faith" that the error propagators in the stack appropriately concatenate to the error string.
Utilizing this method it'd be standard to "push" your error to the stack, and return it to the caller/user of your wrappers/plugins.
Example error stack:
message: "DeFiWrapper: Failed to fetch token data"
source: {file: "./query/index.ts", row: 102, col: 20}
uri: "w3://ens/defiwrapper.eth"
> message: "UniswapTokenResolver: Unknown pair address"
source: {file: "./query/pairs/resolver.ts", row: 40, col: 84}
uri: "w3://ens/uni.resolvers.defiwrapper.eth"
> message: "Ethereum: Invalid address '0xBAD_ADDRESS'"
source: {file: "./src/resolver.ts", row: 4343, col: 63}
uri: "w3://ens/ethereum.wrappers.eth"
..........
Currently, we utilize basic strings for errors, wrapping them within the various languages we have software in (JavaScript & AssemblyScript
Errorstructure, Rust's Err structure, etc).In the same way that we have standardized structures for the various cross-module operations we support (invoke & subinvoke for example), we should have a standardize error structure that is used.
Information within this structure would include:
Utilizing this information, we can re-create an error-stack, enabling them to further debug where the root cause came from.
Currently we do this through string concatenation & "good faith" that the error propagators in the stack appropriately concatenate to the error string.
Utilizing this method it'd be standard to "push" your error to the stack, and return it to the caller/user of your wrappers/plugins.
Example error stack: