Error handling

Error handling is currently patchy at best. This adds something slightly more presentable.

It doesn't fix all the locations where we are `res.send`ing errors, so at some point we'll have to convert all the `return res.send(500, err)`s into `return next(err)`s.