Skip to content
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

Return errors as strings, not resources #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abrown
Copy link
Collaborator

@abrown abrown commented Aug 13, 2024

This change proposes a different approach to simplifying errors than PR #75 (errors as records). Here we take that approach one step further and completely remove the error code portion entirely, returning only a string in the error case. Is this an anti-pattern, though? Some would argue that this is the case, since users might have to resort to string-matching for custom error handling. Others, however, might argue that the error codes were low value anyways since we expect to only see one or maybe two variants as failures to a single call. In any case, this PR offers an alternative to #75 for discussion sake.

This change proposes a different approach to simplifying errors than PR
 WebAssembly#75 (errors as records). Here we take that approach one step further and
completely remove the error code portion entirely, returning only a
`string` in the error case. Is this an anti-pattern, though? Some would
argue that this is the case, since users might have to resort to
string-matching for custom error handling. Others, however, might argue
that the error codes were low value anyways since we expect to only see
one or maybe two variants as failures to a single call. In any case,
this PR offers an alternative to WebAssembly#75 for discussion sake.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant