Skip to content


Actually bail if db not present. Fixes #4. #6

wants to merge 1 commit into from

3 participants

Mozilla member

@jedp or @seanmonstar, mind having a look?

Hmm. arguably if the DB is gone we should return a 500 every time?

Ah well. This preserves current behavior, minus one bug I found (#4) and another I didn't (when you try to DELETE a user programmatically and the DB is gone, same badness).

res.json/res.send means res is done, but the function continues, does where db is null, and, f7u12.

Mozilla member

yea, strange that we'd return a 200 if the db is gone. that sounds like a 500 to me.


I'm with @seanmonstar on returning a 500. Possibly even a res.json(500, {"error":"dude, where's your database?"})

Mozilla member

thanks for the feedback, yall.

@6a68 6a68 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 9, 2013
  1. @6a68
Showing with 2 additions and 2 deletions.
  1. +2 −2 webserver.js
4 webserver.js
@@ -32,7 +32,7 @@ function canonicalize(email) {
// the 'todo/get' api gets the current version of the todo list
// from the server
app.get('/mail/:user', function(req, res) {
- if (!db) res.json([]);
+ if (!db) return res.json([]);
req.params.user = canonicalize(req.params.user);
@@ -53,7 +53,7 @@ app.get('/mail/:user', function(req, res) {
app.delete('/mail/:user', function(req, res) {
- if (!db) res.send(200);
+ if (!db) return res.send(200);
req.params.user = canonicalize(req.params.user);
Something went wrong with that request. Please try again.