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

Should Error instances have a dedicated Exception property? #114

Open
feO2x opened this issue Jun 25, 2024 · 0 comments
Open

Should Error instances have a dedicated Exception property? #114

feO2x opened this issue Jun 25, 2024 · 0 comments

Comments

@feO2x
Copy link
Contributor

feO2x commented Jun 25, 2024

ErrorOr is often used in circumstances where exceptions might be thrown (for example, during I/O calls) which are then translated to an Error instance. While its technically possible to store the exception in the Error.Metadata dictionary, I wanted to ask if it would be useful to have a dedicated Exception property on the Error struct? Of course, this value of this property could be null.

When I work with other developers, they often forget to pass an exception on to the caller. These callers are responsible for logging as it has more context - the exception and especially its stack trace will never show up in any log.

We could also introduce a static FromException() where the we can provide customizable retrieval of error codes, descriptions, error types and metadata for popular exception types.

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

No branches or pull requests

1 participant