Skip to content

Commit

Permalink
fix url of can_fail page. (zio#6805)
Browse files Browse the repository at this point in the history
  • Loading branch information
khajavi authored May 13, 2022
1 parent 9d4cec3 commit 2828be1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/shared/src/main/scala-2.11/zio/CanFail.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scala.annotation.implicitNotFound
"your effect has Nothing for the error type, which means it cannot " +
"fail, so there is no need to handle the failure. To find out which " +
"method you can use instead of this operation, please see the " +
"reference chart at: https://zio.dev/docs/can_fail"
"reference chart at: https://zio.dev/version-1.x/can_fail"
)
sealed abstract class CanFail[-E]

Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala-2.12-2.13/zio/CanFail.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object CanFail extends CanFail[Any] {
"your effect has Nothing for the error type, which means it cannot " +
"fail, so there is no need to handle the failure. To find out which " +
"method you can use instead of this operation, please see the " +
"reference chart at: https://zio.dev/docs/can_fail"
"reference chart at: https://zio.dev/version-1.x/can_fail"
)
implicit val canFailAmbiguous1: CanFail[Nothing] = CanFail
implicit val canFailAmbiguous2: CanFail[Nothing] = CanFail
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala-3/zio/CanFail.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import scala.util.NotGiven
"your effect has Nothing for the error type, which means it cannot " +
"fail, so there is no need to handle the failure. To find out which " +
"method you can use instead of this operation, please see the " +
"reference chart at: https://zio.dev/docs/can_fail"
"reference chart at: https://zio.dev/version-1.x/can_fail"
)
sealed abstract class CanFail[-E]

Expand Down
11 changes: 6 additions & 5 deletions docs/canfail.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
id: can_fail
title: "Compile Time Errors for Handling Combinators"
slug: can_fail
---

ZIO provides a variety of combinators to handle errors such as `orElse`, `catchAll`, `catchSome`, `option`, `either`, and `retry`. However, these combinators only make sense for effects that can fail (i.e. where the error type is not `Nothing`). To help you identify code that doesn't make sense, error handling combinators require implicit evidence `CanFail[E]`, which is automatically available for all types except `Nothing`. The table below includes a list of combinators that only make sense for effects that can fail along with value preserving rewrites.

**ZIO**
## ZIO

Code | Rewrite
--- | ---
Expand Down Expand Up @@ -40,7 +41,7 @@ Code | Rewrite
`ZIO.validateM(in)(f)` | `ZIO.foreach(in)(f)`*
`ZIO.validateFirstM(in)(f)` | `ZIO.foreach(in)(f)`*

**ZManaged**
## ZManaged

Code | Rewrite
--- | ---
Expand All @@ -65,7 +66,7 @@ Code | Rewrite
`umanaged.refineToOrDieWith(pf)(f)` | `umanaged`
`umanaged.retry(s)` | `umanaged`

**ZStream**
## ZStream

Code | Rewrite
--- | ---
Expand All @@ -75,14 +76,14 @@ Code | Rewrite
`ustream.mapError(f)` | `ustream`
`ustream.orElse(zstream)` | `ustream`

**ZStreamChunk**
## ZStreamChunk

Code | Rewrite
--- | ---
`ustream.either` | `ustream`
`ustream.orElse(zstream)` | `ustream`

(*) Notes:
## (*) Notes:

- `either`, `option`, `orElseEither`, and `retryOrElseEither` wrap their results in `Some` or `Right` so after rewriting, code calling these methods can be simplified to accept an `A` rather than an `Option[A]` or `Either[E, A]`.

Expand Down

0 comments on commit 2828be1

Please sign in to comment.