File tree Expand file tree Collapse file tree 2 files changed +19
-11
lines changed
Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 99 data Exception :: !
1010
1111
12+ ### Type Class Instances
13+
14+ instance showError :: Show Error
15+
16+
1217### Values
1318
1419 catchException :: forall a eff. (Error -> Eff eff a) -> Eff (err :: Exception | eff) a -> Eff eff a
1722
1823 message :: Error -> String
1924
20- stackTrace :: Error -> String
25+ showErrorImpl :: Error -> String
2126
2227 throwException :: forall a eff. Error -> Eff (err :: Exception | eff) a
Original file line number Diff line number Diff line change @@ -5,22 +5,25 @@ import Control.Monad.Eff
55foreign import data Exception :: !
66
77foreign import data Error :: *
8-
9- foreign import message
10- " function message(e) {\
11- \ return e.message;\
12- \}" :: Error -> String
13-
14- foreign import stackTrace
15- " function stack(e) {\
16- \ return e.stack;\
8+
9+ instance showError :: Show Error where
10+ show = showErrorImpl
11+
12+ foreign import showErrorImpl
13+ " function showErrorImpl(err) {\
14+ \ return err.stack ? err.stack : err.toString();\
1715 \}" :: Error -> String
1816
1917foreign import error
2018 " function error(msg) {\
2119 \ return new Error(msg);\
22- \}" :: String -> Error
20+ \}; " :: String -> Error
2321
22+ foreign import message
23+ " function message(e) {\
24+ \ return e.message;\
25+ \}" :: Error -> String
26+
2427foreign import throwException
2528 " function throwException(e) {\
2629 \ return function() {\
You can’t perform that action at this time.
0 commit comments