Skip to content

Commit

Permalink
Custom Error page
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBeale committed May 5, 2015
1 parent 1a69b8e commit 89109a7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,24 @@ module.exports = function (rootDirectory, logger, indexDocument, errorDocument)

if (indexDocument)
{
return notFoundResponse(req, res);
if (errorDocument)
{
fileStore.getObject(req.bucket, errorDocument, function (err, object, data) {
if (err)
{
console.error('Custom Error Document not found: ' + errorDocument);
return notFoundResponse(req, res);
}
else
{
return buildResponse(req, res, 404, object, data);
}
});
}
else
{
return notFoundResponse(req, res);
}
}
else
{
Expand Down

0 comments on commit 89109a7

Please sign in to comment.