File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed
Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Breaking changes:
88
99New features:
1010- Add ` errorWithCause ` (#43 by @sigma-andex )
11+ - Add ` errorWithName ` (#44 by @jedimahdi )
1112
1213Bugfixes:
1314
Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ export function errorWithCause(msg) {
1212 } ;
1313}
1414
15+ export function errorWithName ( msg ) {
16+ return function ( name ) {
17+ const e = new Error ( msg ) ;
18+ e . name = name ;
19+ return e ;
20+ } ;
21+ }
22+
1523export function message ( e ) {
1624 return e . message ;
1725}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ module Effect.Exception
66 , catchException
77 , error
88 , errorWithCause
9+ , errorWithName
910 , message
1011 , name
1112 , stack
@@ -36,6 +37,9 @@ foreign import error :: String -> Error
3637-- | Create a JavaScript error, specifying a message and a cause
3738foreign import errorWithCause :: String -> Error -> Error
3839
40+ -- | Create a JavaScript error, specifying a message and a name
41+ foreign import errorWithName :: String -> String -> Error
42+
3943-- | Get the error message from a JavaScript error
4044foreign import message :: Error -> String
4145
You can’t perform that action at this time.
0 commit comments