@@ -24,17 +24,16 @@ module Node.Process
24
24
25
25
import Prelude
26
26
27
- import Effect (Effect )
28
-
29
27
import Data.Maybe (Maybe )
30
28
import Data.Posix (Pid )
31
29
import Data.Posix.Signal (Signal )
32
30
import Data.Posix.Signal as Signal
31
+ import Effect (Effect )
32
+ import Effect.Exception (Error )
33
33
import Foreign.Object as FO
34
34
import Node.Platform (Platform )
35
35
import Node.Platform as Platform
36
36
import Node.Stream (Readable , Writable )
37
-
38
37
import Unsafe.Coerce (unsafeCoerce )
39
38
40
39
-- YOLO
@@ -56,6 +55,23 @@ foreign import onBeforeExit :: Effect Unit -> Effect Unit
56
55
-- | to exit with.
57
56
foreign import onExit :: (Int -> Effect Unit ) -> Effect Unit
58
57
58
+ -- | Install a handler for uncaught exceptions. The callback will be called
59
+ -- | when the process emits the `uncaughtException` event. The handler
60
+ -- | currently does not expose the second `origin` argument from the Node 12
61
+ -- | version of this event to maintain compatibility with older Node versions.
62
+ foreign import onUncaughtException :: (Error -> Effect Unit ) -> Effect Unit
63
+
64
+ -- | Install a handler for unhandled promise rejectionsgq. The callback will be
65
+ -- | called when the process emits the `unhandledRejection` event.
66
+ -- |
67
+ -- | The first argument to the handler can be whatever type the unhandled
68
+ -- | Promise yielded on rejection (typically, but not necessarily, an `Error`).
69
+ -- |
70
+ -- | The handler currently does not expose the type of the second argument,
71
+ -- | which is a `Promise`, in order to allow users of this library to choose
72
+ -- | their own PureScript `Promise` bindings.
73
+ foreign import onUnhandledRejectionImpl :: forall a b . (a -> b -> Effect Unit ) -> Effect Unit
74
+
59
75
foreign import onSignalImpl :: String -> Effect Unit -> Effect Unit
60
76
61
77
-- | Install a handler for a particular signal.
0 commit comments