File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ The type of Javascript errors
2121
2222##### Instances
2323``` purescript
24- instance showError :: Show Error
24+ Show Error
2525```
2626
2727#### ` error `
@@ -74,4 +74,13 @@ main = catchException print do
7474 trace "Exceptions thrown in this block will be logged to the console"
7575```
7676
77+ #### ` throw `
78+
79+ ``` purescript
80+ throw :: forall eff a. String -> Eff (err :: EXCEPTION | eff) a
81+ ```
82+
83+ A shortcut allowing you to throw an error in one step. Defined as
84+ ` throwException <<< error ` .
85+
7786
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ module Control.Monad.Eff.Exception
88 , message
99 , throwException
1010 , catchException
11+ , throw
1112 ) where
1213
1314import Prelude
@@ -53,3 +54,8 @@ foreign import throwException :: forall a eff. Error -> Eff (err :: EXCEPTION |
5354-- | trace "Exceptions thrown in this block will be logged to the console"
5455-- | ```
5556foreign import catchException :: forall a eff . (Error -> Eff eff a ) -> Eff (err :: EXCEPTION | eff ) a -> Eff eff a
57+
58+ -- | A shortcut allowing you to throw an error in one step. Defined as
59+ -- | `throwException <<< error`.
60+ throw :: forall eff a . String -> Eff (err :: EXCEPTION | eff ) a
61+ throw = throwException <<< error
You can’t perform that action at this time.
0 commit comments