Skip to content

Commit f35f89f

Browse files
author
deiu
committed
Respond with error status and message instead of next(); fixes weird [object Object] prints
1 parent dc9921f commit f35f89f

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎lib/handlers/error.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ function errorPageHandler(err, req, res, next) {
99
// If noErrorPages is set,
1010
// then use built-in express default error handler
1111
if (ldp.noErrorPages) {
12-
return next(err);
12+
return res
13+
.status(err.status)
14+
.send(err.message);
1315
}
1416

1517
// Check if error page exists

‎lib/handlers/get.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function aclAllow(match, req, res, callback) {
178178
var relativePath = '/' + path.relative(ldp.root, match);
179179
res.locals.path = relativePath;
180180
acl.allow("Read", req, res, function(err) {
181-
callback(!err);
181+
callback(err);
182182
});
183183
}
184184

@@ -217,7 +217,7 @@ function parseLinkedData(req, res, next) {
217217
$rdf.serialize(undefined, resourceGraph, null, accept, function(err, result) {
218218
if (result === undefined || err) {
219219
debug("GET/HEAD -- Serialization error: " + err);
220-
var serializeErr = new Error();
220+
var serializeErr = {};
221221
serializeErr.status = 500;
222222
serializeErr.message = err.message;
223223
return next(serializeErr);

0 commit comments

Comments
 (0)