Skip to content

Instantly share code, notes, and snippets.

@katydorjee
Last active February 16, 2024 05:55
Show Gist options
  • Save katydorjee/12c334945d306a7743af1c1d3cc43bdb to your computer and use it in GitHub Desktop.
Save katydorjee/12c334945d306a7743af1c1d3cc43bdb to your computer and use it in GitHub Desktop.
Logging SSJS errors on the client side.
<script runat="server">
var isDebug = true;
try {
var a = 1;
var b = "six";
var result = 1 / b;
if(isDebug)
Write('<script>console.log("result: ' + result + '")</script>');
} catch (ex) {
if(isDebug)
Write('<script>console.error("' + ex + '")</script>');
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment