Skip to content

Commit

Permalink
Added the 'catching' function as an extension method.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcardin committed Apr 24, 2024
1 parent d6cf227 commit 599dfa3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/scala/in/rcard/raise4s/Raise.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ infix type raises[R, Error] = Raise[Error] ?=> R
object Raise {

extension [A](a: => A)
/** Extensions method version of the [[Raise.catching]] function.
*/
@targetName("catchingThis")
def catching(catchBlock: Throwable => A): A = Raise.catching(() => a, catchBlock)

Expand Down

0 comments on commit 599dfa3

Please sign in to comment.