-
Couldn't load subscription status.
- Fork 1.4k
Documentation for ZIO's Error Management #6313
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
Conversation
|
Worth looking at: https://gist.github.com/quelgar/d383cd960d781fe72a1564203c280a03 As it addresses many topics important to consider in this phase of the documentation. |
Great article! Yes, I noticed that from your tweets. |
|
While documenting union types on ZIO's error parameter, a question popped into my head. Why the compiler does not infer the proper type for // Two unrelated errors without having a common supertype (e.g. FooBarError) or the Throwable/Exception supertype
trait FooError
trait BarError
// Why the compiler doesn't infer the error type as `FooError | BarError`?
val myApp: ZIO[Any, Object, Unit] = for {
_ <- ZIO.fail(new FooError {})
_ <- ZIO.fail(new BarError {})
} yield ()Update: I found that it is the inherent behavior of the Scala 3's type system related to the LUB algorithm and is not related to ZIO itself. |
|
Hi @khajavi , could you please add some description of Sometimes we want to turn a Somewhere in my application I have a generic top level handler which does something like Is this the right usage of ? Also, is it possible to add a section saying something like "don't be lazy, encode errors with ADTs instead of using Throwable as an |
|
@edubrovski I'm not sure this is a use case for resurrect, if those errors are unexpected errors, why not use |
|
@khajavi,
|
|
In theory, if we changed |
9ce4feb to
b6a400f
Compare
|
@khajavi Are you done with this one? |
|
@jdegoes |
afe5ddf to
80e2ce2
Compare
|
@jdegoes |
0eef517 to
8a7bdbd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the docs on Sandboxing useful and just wanted to check if there was a typo with inline queries. Thanks.
# Conflicts: # docs/datatypes/core/zio/zio.md
# Conflicts: # docs/datatypes/core/zio/zio.md
| ### 3. Fatal Errors | ||
|
|
||
| In ZIO, the `VirtualMachineError` and all its subtypes are the only errors considered fatal by the ZIO runtime. So if during the running application, the JVM throws any of these errors like `StackOverflowError`, the ZIO runtime considers it as a catastrophic fatal error. So it will interrupt the whole application immediately without safe resource interruption. None of the `ZIO#catchAll` and `ZIO#catchAllDefects` can catch these fatal errors. At most, if the `RuntimeConfig.reportFatal` is enabled, the application will log the stack trace before interrupting the whole application. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe RuntimeConfig (and RuntimeConfigAspect) have been deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am making things challenging for @khajavi here. 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, I'm keeping the branch up to date regularly ;)
@adamgfraser
Before the removal of RuntimeConfig, we had the ability to specify fatal errors:
val c: RuntimeConfig = ???
c.fatal { case x: Throwable => x.isInstanceOf[Foo] }But I can't find the corresponding method in the new version. We won't support doing so anymore?
Uh oh!
There was an error while loading. Please reload this page.