Better (more private...) error handling
This commit is contained in:
@@ -18,7 +18,7 @@ router.get('/iiif/:manifestid/manifest', async function(req, res) {
|
||||
res.status(500).json({
|
||||
status: 500,
|
||||
message: 'There was an error processing this request',
|
||||
details: error
|
||||
code: error.code ?? 'not available',
|
||||
});
|
||||
}
|
||||
res.json(manifest);
|
||||
@@ -31,7 +31,11 @@ router.get('/iiif/:manifestid/canvas/:name', async function(req, res) {
|
||||
try {
|
||||
canvas = await generateCanvas(req.params.manifestid, req.params.name)
|
||||
} catch(error) {
|
||||
res.status(500).json({status: 500, message: 'There was an error processing this request: ' + error});
|
||||
res.status(500).json({
|
||||
status: 500,
|
||||
message: 'There was an error processing this request',
|
||||
code: error.code ?? 'not available',
|
||||
});
|
||||
return;
|
||||
}
|
||||
res.json(canvas);
|
||||
@@ -44,7 +48,11 @@ router.get('/iiif/:manifestid/sequence/:name', async function(req, res) {
|
||||
try {
|
||||
sequence = await generateSequence(req.params.manifestid, req.params.name)
|
||||
} catch(error) {
|
||||
res.status(500).json({status: 500, message: 'There was an error processing this request'});
|
||||
res.status(500).json({
|
||||
status: 500,
|
||||
message: 'There was an error processing this request',
|
||||
code: error.code ?? 'not available',
|
||||
});
|
||||
}
|
||||
res.json(sequence);
|
||||
});
|
||||
@@ -55,7 +63,11 @@ router.get('/params', async function(req, res) {
|
||||
try {
|
||||
res.json(await exposeParams());
|
||||
} catch(error) {
|
||||
res.status(500).json({status: 500, message: 'There was an error processing this request'});
|
||||
res.status(500).json({
|
||||
status: 500,
|
||||
message: 'There was an error processing this request',
|
||||
code: error.code ?? 'not available',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user