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.
24 lines
563 B
JavaScript
24 lines
563 B
JavaScript
class DefaultError extends Error {
|
|
constructor(code, message, error) {
|
|
super(message)
|
|
this.code = code
|
|
this.error = error
|
|
this.message = message || "Internal Server Error"
|
|
this.isOperational = true
|
|
|
|
Error.captureStackTrace(this, this.constructor)
|
|
}
|
|
|
|
serialize() {
|
|
const response = {
|
|
code: this.code,
|
|
message: this.message,
|
|
}
|
|
if (this.error) {
|
|
response.error = this.error
|
|
}
|
|
return response
|
|
}
|
|
}
|
|
|
|
module.exports = DefaultError |