Created
June 28, 2018 21:42
-
-
Save mbergal/f104df41ad5be4c6804b02ae65dd24bf to your computer and use it in GitHub Desktop.
JavaScript-exception-stack-trace.re
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let throwError: unit => unit = [%bs.raw | |
{|function () { throw new Error("aaaa"); }|} | |
]; | |
try (throwError()) { | |
| Js.Exn.Error(e) => | |
switch (Js.Exn.message(e)) { | |
| Some(message) => Js.log({j|Error>>>>>: $message|j}) | |
| None => Js.log("An unknown error occurred") | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment