Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
rust: support rich errors #769
rust: support rich errors #769
Changes from all commits
5f9a1a8
b35139e
9d9aa4d
bf11f30
3da0019
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These assertions show the current error reporting system is not prefect, as there are two ways to tell failure, error code or the return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For validate theoretically we could return error code instead of
bool
(plus optional error message), but for parse and instantiate it seems inevitable: we have to return a pointer to module / instance in any case, and when we also return an error code this pointer is going to be NULL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add assertions into the capi for this? Or at least extend the tests? And document it?
These
debug_assert
s here act like the C assert, they are not part of a release build. Happy to keep them though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests already have checks for both return value and error for both failure and success cases.
Assertions in C API - not sure where and which ones (it seems kind of obvious there that error is set when
false
ornullptr
is returned)Document it - something like
Returned error code is FIZZY_SUCCESS iff return value is true
? Sounds somewhat obvious, too...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess documentation is fine just saying that
error code must be FIZZY_SUCCESS
if a pointer is returned andmust NOT be FIZZY_SUCCESS
otherwise? Basically we want to give indication to the user that they do not need to check both.