Initial commit: DashCaddy v1.0

Full codebase including API server (32 modules + routes), dashboard frontend,
DashCA certificate distribution, installer script, and deployment skills.
This commit is contained in:
2026-03-05 02:26:12 -08:00
commit f61e85d9a7
337 changed files with 75282 additions and 0 deletions

48
dashcaddy-api/errors.js Normal file
View File

@@ -0,0 +1,48 @@
/**
* Typed Error Classes for DashCaddy API
* Provides structured errors that the global error handler catches automatically.
*/
class AppError extends Error {
constructor(message, statusCode = 500, code = 'INTERNAL_ERROR') {
super(message);
this.name = this.constructor.name;
this.statusCode = statusCode;
this.code = code;
}
}
class DockerError extends AppError {
constructor(message, details = {}) {
super(message, 500, 'DOCKER_ERROR');
this.details = details;
}
}
class CaddyError extends AppError {
constructor(message, details = {}) {
super(message, 502, 'CADDY_ERROR');
this.details = details;
}
}
class DNSError extends AppError {
constructor(message, details = {}) {
super(message, 502, 'DNS_ERROR');
this.details = details;
}
}
class AuthenticationError extends AppError {
constructor(message = 'Authentication required') {
super(message, 401, 'AUTH_REQUIRED');
}
}
class NotFoundError extends AppError {
constructor(resource = 'Resource') {
super(`${resource} not found`, 404, 'NOT_FOUND');
}
}
module.exports = { AppError, DockerError, CaddyError, DNSError, AuthenticationError, NotFoundError };