Skip to content

500 Internal Server Error

The classic server crash. The server threw an unhandled exception or encountered a condition it couldn’t recover from.

Use this as a last-resort catch-all. If your code completely panics, throws an unhandled exception, or fails to connect to the database, catch it at the top level and return a 500.

import { HttpException, get } from 'shokupan';
export const getDashboard = get('/dashboard', async () => {
try {
const stats = await db.analytics.getHeavyQuery();
return stats;
} catch (err) {
console.error('Database query failed:', err);
throw new HttpException('Internal Server Error', 500);
}
});