Spaces:
Running
Running
Download src/utils/errorHandler.ts from m97j/archive-core: direct link, hf CLI and curl.
- Browser
- Download file 394 Bytes
-
https://huggingface.co/spaces/m97j/archive-core/resolve/main/src/utils/errorHandler.ts
- Command line
-
hf download hf://spaces/m97j/archive-core/src/utils/errorHandler.ts
-
curl -L -o errorHandler.ts https://huggingface.co/spaces/m97j/archive-core/resolve/main/src/utils/errorHandler.ts
394 Bytes
| // backend/src/utils/errorHandler.ts | |
| import { NextFunction, Request, Response } from 'express'; | |
| export function errorHandler(err: any, _req: Request, res: Response, _next: NextFunction) { | |
| const status = err.status || 500; | |
| const message = err.message || 'Internal Server Error'; | |
| console.error('[Error]', status, message, err.stack || err); | |
| res.status(status).json({ error: message }); | |
| } | |