@@ -10,40 +10,50 @@ instance showError :: Show Error where
1010 show = showErrorImpl
1111
1212foreign import showErrorImpl
13- " function showErrorImpl(err) {\
14- \ return err.stack ? err.stack : err.toString();\
15- \}" :: Error -> String
13+ " " "
14+ function showErrorImpl(err) {
15+ return err.stack || err.toString();
16+ }
17+ " " " :: Error -> String
1618
1719foreign import error
18- " function error(msg) {\
19- \ return new Error(msg);\
20- \};" :: String -> Error
20+ " " "
21+ function error(msg) {
22+ return new Error(msg);
23+ }
24+ " " " :: String -> Error
2125
2226foreign import message
23- " function message(e) {\
24- \ return e.message;\
25- \}" :: Error -> String
27+ " " "
28+ function message(e) {
29+ return e.message;
30+ }
31+ " " " :: Error -> String
2632
2733foreign import throwException
28- " function throwException(e) {\
29- \ return function() {\
30- \ throw e;\
31- \ };\
32- \}" :: forall a eff . Error -> Eff (err :: Exception | eff ) a
34+ " " "
35+ function throwException(e) {
36+ return function() {
37+ throw e;
38+ };
39+ }
40+ " " " :: forall a eff . Error -> Eff (err :: Exception | eff ) a
3341
3442foreign import catchException
35- " function catchException(c) {\
36- \ return function(t) {\
37- \ return function() {\
38- \ try {\
39- \ return t();\
40- \ } catch(e) {\
41- \ if (e instanceof Error || {}.toString.call(e) === '[object Error]') {\
42- \ return c(e)();\
43- \ } else {\
44- \ return c(new Error(e.toString()))();\
45- \ }\
46- \ }\
47- \ };\
48- \ };\
49- \}" :: forall a eff . (Error -> Eff eff a ) -> Eff (err :: Exception | eff ) a -> Eff eff a
43+ " " "
44+ function catchException(c) {
45+ return function(t) {
46+ return function() {
47+ try {
48+ return t();
49+ } catch(e) {
50+ if (e instanceof Error || Object.prototype.toString.call(e) === '[object Error]') {
51+ return c(e)();
52+ } else {
53+ return c(new Error(e.toString()))();
54+ }
55+ }
56+ };
57+ };
58+ }
59+ " " " :: forall a eff . (Error -> Eff eff a ) -> Eff (err :: Exception | eff ) a -> Eff eff a
0 commit comments