/**
 * 结构化错误基类 — 提供统一的错误码、严重性和恢复建议。
 *
 * 使用方式:
 *   throw new SoloForgeError("配置加载失败", "CONFIG_LOAD_ERROR", "error", "检查 config.yaml 格式");
 */
/**
 * SoloForge 结构化错误
 */
export class SoloForgeError extends Error {
    /** 错误码 — 用于程序化识别错误类型 */
    code;
    /** 严重性 — error 或 warning */
    severity;
    /** 恢复建议 */
    recovery;
    constructor(message, code, severity = "error", recovery) {
        super(message);
        this.name = "SoloForgeError";
        this.code = code;
        this.severity = severity;
        this.recovery = recovery;
    }
    /** 序列化为 JSON 友好格式 */
    toJSON() {
        return {
            name: this.name,
            message: this.message,
            code: this.code,
            severity: this.severity,
            recovery: this.recovery,
        };
    }
}
//# sourceMappingURL=errors.js.map