MCPcopy
hub / github.com/laurentj/slimerjs / NS_ASSERT

Function NS_ASSERT

src/components/httpd.js:68–81  ·  view source on GitHub ↗

* Asserts that the given condition holds. If it doesn't, the given message is * dumped, a stack trace is printed, and an exception is thrown to attempt to * stop execution (which unfortunately must rely upon the exception not being * accidentally swallowed by the code that uses it).

(cond, msg)

Source from the content-addressed store, hash-verified

66 * accidentally swallowed by the code that uses it).
67 */
68function NS_ASSERT(cond, msg)
69{
70 if (DEBUG && !cond)
71 {
72 dumpn("###!!!");
73 dumpn("###!!! ASSERTION" + (msg ? ": " + msg : "!"));
74 dumpn("###!!! Stack follows:");
75
76 var stack = new Error().stack.split(/\n/);
77 dumpn(stack.map(function(val) { return "###!!! " + val; }).join("\n"));
78
79 throw Cr.NS_ERROR_ABORT;
80 }
81}
82
83/** Constructs an HTTP error object. */
84this.HttpError = function HttpError(code, description)

Callers 2

httpd.jsFile · 0.85
defaultIndexHandlerFunction · 0.85

Calls 1

dumpnFunction · 0.85

Tested by

no test coverage detected