Skip to content

Commit

Permalink
Don't terminate process/script on async exception
Browse files Browse the repository at this point in the history
  • Loading branch information
aantron committed Aug 1, 2018
1 parent 16469d0 commit 40795d4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/docs/api.md
Expand Up @@ -209,8 +209,8 @@ onUnhandledException: ref(exn => never)

When a callback called by Repromise (such as what you pass to [`wait`](#wait)) raises an exception, the exception is passed to `Repromise.onUnhandledException^`.

When your program starts, `Repromise.onUnhandledException` contains a function which prints the exception, and terminates the program. Replace the reference to change this behavior.
When your program starts, `Repromise.onUnhandledException` contains a function which prints the exception to the error log (on JavaScript) or STDERR (on native). Replace the reference to change this behavior.

In the future, we will want to design a wiser approach to asynchronous exception handling. See https://github.com/aantron/repromise/issues/16 for a discussion.
In the future, we may want to design a wiser approach to asynchronous exception handling. See https://github.com/aantron/repromise/issues/16 for a discussion.

<br/>
1 change: 0 additions & 1 deletion src/js/repromise.re
Expand Up @@ -9,7 +9,6 @@ type t('a) = promise('a);
let onUnhandledException = ref(exn => {
prerr_endline("Unhandled exception in promise callback:");
prerr_endline(Printexc.to_string(exn));
exit(2);
});


Expand Down
2 changes: 1 addition & 1 deletion src/js/repromise.rei
Expand Up @@ -54,7 +54,7 @@ module Rejectable: {



let onUnhandledException: ref(exn => never);
let onUnhandledException: ref(exn => unit);



Expand Down
1 change: 0 additions & 1 deletion src/native/repromise.re
Expand Up @@ -57,7 +57,6 @@ let onUnhandledException = ref(exn => {
prerr_endline("Unhandled exception in promise callback:");
prerr_endline(Printexc.to_string(exn));
Printexc.print_backtrace(stderr);
exit(2);
});


Expand Down
2 changes: 1 addition & 1 deletion src/native/repromise.rei
Expand Up @@ -50,7 +50,7 @@ module Rejectable: {



let onUnhandledException: ref(exn => never);
let onUnhandledException: ref(exn => unit);



Expand Down

0 comments on commit 40795d4

Please sign in to comment.