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

Error.getUnsafe #123

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

jmagaram
Copy link
Contributor

@jmagaram jmagaram commented Mar 24, 2023

Provides a way to get a custom property value out of an Error. Includes full documentation, warnings, and a test. This satisfies a real-world scenario of me trying to get the "code" property out of a Firebase SDK exception. See discussion in
#102.

Note there is no module to deal with exn that aren't subclassed Error objects; it could have gone there I guess. But I'm fine with working off Error objects.

See the doc comments. I wanted to type the return value as unknown to make this safe but there is no agreement on that right now. I think if we beef up the Type module #118 we can provide a safer and more comprehensive way of dealing with this kind of thing here and in the Object module.

Copy link
Contributor

@glennsl glennsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree that it would be better to have a beefed-up Type module with a generalized version of this.

src/Core__Error.resi Outdated Show resolved Hide resolved
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.

2 participants