uniffi-rs
uniffi-rs copied to clipboard
Include the messages for rich error structures
For #460, we added support for throwing errors with field data. However, now that I'm trying to use those errors, I realize they are missing an important feature from field-less errors: the message data. A good message can be critical for figuring out what caused the error, but if you use errors with fields then you lose the message functionality.
You could make message one of the fields, but I'm not sure that means it will get printed out in the stack traces. To use Kotlin for an example, you want the message to be passed to the superclass constructor (compare this with this)
I think we should change it so that:
- We always write
error.to_string()toRustBuffer, before any fields data. - We use that string as the message/description for the error and make sure it gets printed to stack traces.
┆Issue is synchronized with this Jira Task ┆Issue Number: UNIFFI-102