fix: handle coin errors gracefully

This commit is contained in:
Face 2025-05-31 13:17:37 +03:00
parent 53909c2874
commit 4479d878ce
3 changed files with 40 additions and 2 deletions

View file

@ -191,7 +191,11 @@ export async function GET({ params, url }) {
timeframe
});
} catch (e) {
console.error('Error fetching coin data:', e);
throw error(500, 'Failed to fetch coin data');
if (e && typeof e === 'object' && 'status' in e) {
throw e;
}
console.error('Unexpected error in coin API:', e);
throw error(500, 'Internal server error');
}
}