Mom-Portal/backend/src/utils/AppError.js
KevinB-T 30894e7f27 Configure VM services and fix auth flow
- point MySQL and Whisper settings to the VM
- add VM MySQL bootstrap scripts and docs
- allow LAN Vite origins for CORS
- fix Express 5 validation assignment crash
- allow login with username or email
- prevent recursive auth refresh retries
2026-05-15 15:19:49 +05:30

17 lines
407 B
JavaScript

export class AppError extends Error {
constructor(message, status = 500, code = "INTERNAL_ERROR", details = null) {
super(message);
this.name = "AppError";
this.status = status;
this.code = code;
this.details = details;
}
}
export function assertFound(value, message = "Resource not found") {
if (!value) {
throw new AppError(message, 404, "NOT_FOUND");
}
return value;
}