Spaces:
Sleeping
Sleeping
Download utils/AppError.js from abubasith86/hayat: direct link, hf CLI and curl.
- Browser
- Download file 488 Bytes
-
https://huggingface.co/spaces/abubasith86/hayat/resolve/main/utils/AppError.js
- Command line
-
hf download hf://spaces/abubasith86/hayat/utils/AppError.js
-
curl -L -o AppError.js https://huggingface.co/spaces/abubasith86/hayat/resolve/main/utils/AppError.js
488 Bytes
| class AppError extends Error { | |
| constructor(message, statusCode) { | |
| super(message); | |
| this.statusCode = statusCode; | |
| this.status = `${statusCode}`.startsWith('4') ? 'fail' : 'error'; // 'fail' for 4xx errors, 'error' for 5xx errors | |
| this.isOperational = true; // Mark this error as operational (not a programming error) | |
| // Capture the stack trace (excluding the constructor call) | |
| Error.captureStackTrace(this, this.constructor); | |
| } | |
| } | |
| module.exports = { AppError }; |