@fran-834/gs-microservice-core
Version:
Core package for Node.js microservices by Galduria Software. Includes security, logging, validation, and error handling middlewares.
23 lines (22 loc) • 739 B
JavaScript
/**
* Centralized error object that extends Node's Error.
* Used for operational errors in the application.
*/
class AppError extends Error {
/**
* Creates an instance of AppError.
* @param name - The name of the error.
* @param httpCode - The HTTP status code.
* @param description - The error description.
* @param isOperational - Indicates if the error is operational.
*/
constructor(name, httpCode, description, isOperational = true) {
super(description);
this.name = name;
this.httpCode = httpCode;
this.description = description;
this.isOperational = isOperational;
Error.captureStackTrace(this, this.constructor);
}
}
export { AppError };