fix: handle coin errors gracefully
This commit is contained in:
parent
53909c2874
commit
4479d878ce
3 changed files with 40 additions and 2 deletions
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue