Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 23922f3

Browse files
“Alexisalexisbcc
“Alexis
authored andcommittedOct 28, 2021
Add error handler, update .env.example
1 parent 89dbc24 commit 23922f3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
 

‎.env.example

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ TWILIO_NOTIFICATION_SERVICE_SID=ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1111

1212
# Optional for Sync. By default, the app uses the 'default' instance on your account.
1313
TWILIO_SYNC_SERVICE_SID=ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
14+
15+
NODE_ENV=production

‎app.js

+11
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ app.use(bodyParser.json());
1919

2020
app.use(router);
2121

22+
// production error handler
23+
// no stacktraces leaked to user
24+
app.use(function(err, req, res, next) {
25+
console.trace(err);
26+
res.status(err.status || 500);
27+
res.send({
28+
message: err.message,
29+
error: {},
30+
});
31+
});
32+
2233
// Get Sync Service Details for lazy creation of default service if needed
2334
syncServiceDetails();
2435

0 commit comments

Comments
 (0)