[blocks] respect 404 error code instead of misleading 500

This commit is contained in:
nymkappa 2025-03-26 23:05:43 +01:00
parent 8b70e65717
commit 2945e47eba
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -406,8 +406,8 @@ class BitcoinRoutes {
res.setHeader('Expires', new Date(Date.now() + 1000 * cacheDuration).toUTCString());
res.json(block);
} catch (e) {
handleError(req, res, 500, 'Failed to get block');
} catch (e: any) {
handleError(req, res, e?.response?.status === 404 ? 404 : 500, 'Failed to get block');
}
}