Don't crash on user function exceptions
This commit is contained in:
@@ -10,8 +10,8 @@ const morgan = require('morgan');
|
|||||||
// Command line opts
|
// Command line opts
|
||||||
const argv = require('minimist')(process.argv.slice(1));
|
const argv = require('minimist')(process.argv.slice(1));
|
||||||
if (!argv.codepath) {
|
if (!argv.codepath) {
|
||||||
console.log("Codepath defaulting to /user.js");
|
argv.codepath = "/userfunc/user";
|
||||||
argv.codepath = "/user.js";
|
console.log("Codepath defaulting to ", argv.codepath);
|
||||||
}
|
}
|
||||||
if (!argv.port) {
|
if (!argv.port) {
|
||||||
console.log("Port defaulting to 8888");
|
console.log("Port defaulting to 8888");
|
||||||
@@ -79,7 +79,11 @@ app.all('/', function (req, res) {
|
|||||||
}
|
}
|
||||||
res.status(status).send(body);
|
res.status(status).send(body);
|
||||||
}
|
}
|
||||||
userFunction(context, callback);
|
try {
|
||||||
|
userFunction(context, callback);
|
||||||
|
} catch(e) {
|
||||||
|
callback(500, "Internal server error")
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(argv.port);
|
app.listen(argv.port);
|
||||||
|
|||||||
Reference in New Issue
Block a user