Some logging and slightly better error handling in the 404, 500, and 403 cases.