Comparing version 0.1.4 to 0.1.5
62
lib.js
@@ -68,16 +68,13 @@ const core = require("./build/Release/ice_node_core"); | ||
}; | ||
// Why setImmediate ? | ||
setImmediate(() => { | ||
try { | ||
let r = handler(req); | ||
if (r && r.then) { | ||
r.then(ok, err); | ||
} else { | ||
ok(r); | ||
} | ||
} catch (e) { | ||
err(e); | ||
try { | ||
let r = handler(req); | ||
if (r && r.then) { | ||
r.then(ok, err); | ||
} else { | ||
ok(r); | ||
} | ||
}); | ||
} catch (e) { | ||
err(e); | ||
} | ||
} | ||
@@ -158,24 +155,27 @@ }); | ||
core.add_endpoint(this.server, rt.path, async call_info => { | ||
let req = new Request(self, rt, call_info); | ||
for (const mw of mws) { | ||
try { | ||
await mw.handler(req, mw); | ||
} catch (e) { | ||
if (e instanceof Response) { | ||
e.send(self, call_info); | ||
} else { | ||
console.log(e); | ||
new Response({ | ||
status: 500, | ||
body: "Internal error" | ||
}).send(self, call_info); | ||
core.add_endpoint(this.server, rt.path, call_info => { | ||
// Why setImmediate ? | ||
setImmediate(async () => { | ||
let req = new Request(self, rt, call_info); | ||
for (const mw of mws) { | ||
try { | ||
await mw.handler(req, mw); | ||
} catch (e) { | ||
if (e instanceof Response) { | ||
e.send(self, call_info); | ||
} else { | ||
console.log(e); | ||
new Response({ | ||
status: 500, | ||
body: "Internal error" | ||
}).send(self, call_info); | ||
} | ||
return; | ||
} | ||
return; | ||
} | ||
} | ||
rt.handler(req); | ||
rt.handler(req); | ||
}); | ||
}, flags); | ||
} | ||
core.add_endpoint(this.server, "", call_info => this.not_found_handler(call_info)); | ||
core.add_endpoint(this.server, "", call_info => setImmediate(() => this.not_found_handler(call_info))); | ||
@@ -182,0 +182,0 @@ core.listen(this.server, addr); |
{ | ||
"name": "ice-node", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Bindings for the Ice Web Framework", | ||
@@ -5,0 +5,0 @@ "main": "lib.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72603