Skip to content

Instantly share code, notes, and snippets.

@mbergal
Created June 28, 2018 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbergal/f104df41ad5be4c6804b02ae65dd24bf to your computer and use it in GitHub Desktop.
Save mbergal/f104df41ad5be4c6804b02ae65dd24bf to your computer and use it in GitHub Desktop.
JavaScript-exception-stack-trace.re
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