File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based
7
7
Breaking changes:
8
8
9
9
New features:
10
+ - Add ` errorWithCause ` (#43 by @sigma-andex )
10
11
11
12
Bugfixes:
12
13
Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ export function error(msg) {
6
6
return new Error ( msg ) ;
7
7
}
8
8
9
+ export function errorWithCause ( msg ) {
10
+ return function ( cause ) {
11
+ return new Error ( msg , { cause } ) ;
12
+ } ;
13
+ }
14
+
9
15
export function message ( e ) {
10
16
return e . message ;
11
17
}
Original file line number Diff line number Diff line change 3
3
4
4
module Effect.Exception
5
5
( Error
6
+ , catchException
6
7
, error
8
+ , errorWithCause
7
9
, message
8
10
, name
9
11
, stack
10
- , throwException
11
- , catchException
12
12
, throw
13
+ , throwException
13
14
, try
14
- ) where
15
+ )
16
+ where
15
17
16
18
import Prelude
17
19
@@ -31,6 +33,9 @@ foreign import showErrorImpl :: Error -> String
31
33
-- | Create a JavaScript error, specifying a message
32
34
foreign import error :: String -> Error
33
35
36
+ -- | Create a JavaScript error, specifying a message and a cause
37
+ foreign import errorWithCause :: String -> Error -> Error
38
+
34
39
-- | Get the error message from a JavaScript error
35
40
foreign import message :: Error -> String
36
41
You can’t perform that action at this time.
0 commit comments