Add environment example, update .gitignore, and switch license to AGPL v3. Introduce error handling classes, ESLint config, and main modules for database, logging, certificate management, and utility functions. Add authentication routes, schemas, and service layer for a modular REST API. Update README and set up repository structure for further development.
32 lines
973 B
JavaScript
32 lines
973 B
JavaScript
class YggdrasilError extends Error {
|
|
/**
|
|
* @param {number} statusCode - Le code HTTP (ex: 403, 415)
|
|
* @param {string} error - Description courte (ex: "ForbiddenOperationException" ou "Unsupported Media Type")
|
|
* @param {string} errorMessage - Description longue pour l'utilisateur
|
|
* @param {string} [cause] - Cause optionnelle de l'erreur
|
|
*/
|
|
constructor(statusCode, error, errorMessage, cause) {
|
|
super(errorMessage)
|
|
this.statusCode = statusCode
|
|
|
|
this.error = error
|
|
this.errorMessage = errorMessage
|
|
this.cause = cause
|
|
|
|
this.isOperational = true
|
|
Error.captureStackTrace(this, this.constructor)
|
|
}
|
|
|
|
serialize() {
|
|
const response = {
|
|
error: this.error,
|
|
errorMessage: this.errorMessage
|
|
}
|
|
if (this.cause) {
|
|
response.cause = this.cause
|
|
}
|
|
return response
|
|
}
|
|
}
|
|
|
|
module.exports = YggdrasilError |