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

Make error generic #22

Open
MehdiRadhouani opened this issue Jul 5, 2019 · 1 comment
Open

Make error generic #22

MehdiRadhouani opened this issue Jul 5, 2019 · 1 comment

Comments

@MehdiRadhouani
Copy link

How handy would it be to not just return a string as an error but a type with more details about the error like: code, message, severity, innerError, ...

For an ongoing project, I needed this feature. I will be proposing a merge request containing this feature hoping that it will be merged.

@krzemin
Copy link
Owner

krzemin commented Jul 6, 2019

Hi,

long time ago I was trying to prototype support for custom types that describe validation errors, so that you can define own sealed type family. For example:

sealed trait MyAppError

case class ThirdPartyServiceError(cause: String) extends MyAppError
case object InvalidAddressError extends MyAppError
...

I gave up on this idea because of some variance issues and overall interface/implementation complexity that wouldn't be justified for simple cases. So for now we have only strings as error messages.

If you want to experiment, possibly with different design goals, please go on. PRs are always welcome. But please make sure that proposed change doesn't affect existing users (that are fine with pure strings) too much :)

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

2 participants