diff --git a/backend/index.js b/backend/index.js index 949a8af..de947ce 100644 --- a/backend/index.js +++ b/backend/index.js @@ -29,7 +29,14 @@ app.post('/write', async (req, res) => { app.get('/read/:hash', async (req, res) => { // Fetch content const { hash } = req.params; - const data = await db.get(req.params.hash); + let data; + try { + data = await db.get(req.params.hash); + } catch (e) { + console.log('read error:', e.message, hash); + res.status(e.status).end(); + return; + } console.log('read', hash); // Return content res.json(data);