Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mlangc
Copy link
Contributor

@mlangc mlangc commented Nov 2, 2019

This PR adapts the signature of ZIO.someOrFailException to better work with commonly used error types like Throwable. For example, without this PR,

Task(Option(3)).someOrFailException

does not compile, but with this PR, it does.

Something that does not yet compile is (io: IO[E, Option[A]]).someOrFailException if E is not a supertype of NoSuchElementException, like (io: IO[IllegalArgumentException, Option[A]]).someOrFailException. Ideally, this should work, with the error type of the result being the most specific common supertype of E and NoSuchElementException, but I didn't yet find a way to achieve this.

In any way, this PR is an improvement over the existing state of affairs.

@iravid
Copy link
Member

iravid commented Nov 11, 2019

Thanks @mlangc!

@iravid iravid merged commit 254e910 into zio:master Nov 11, 2019
Twizty pushed a commit to Twizty/zio that referenced this pull request Nov 13, 2019
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