package com.agent.management.engine.hermes;

/**
 * Hermes Bridge 返回的 {@code done} 事件内容被嗅探为错误响应时抛出。
 *
 * <p>区别于 {@code RuntimeException}：</p>
 * <ul>
 *   <li>{@code HermesBridgeClient} 在 SSE done 分支检测到 finalText 命中错误模式时抛本异常</li>
 *   <li>{@code HermesAgentExecutor} / {@code HermesSmartActionExecutor} 的 catch 块统一捕获 Exception
 *       并转化为 {@code NodeExecutionResult.failed}，{@code getMessage()} 已包含命中模式与原始响应摘要</li>
 *   <li>后续若需要区分"限流可重试"与"认证不可重试"，可基于本异常的 {@code matchedPatternName} 做精细化策略</li>
 * </ul>
 */
public class HermesErrorResponseException extends RuntimeException {

    private final String matchedPatternName;

    public HermesErrorResponseException(String message, String matchedPatternName) {
        super(message);
        this.matchedPatternName = matchedPatternName;
    }

    public String getMatchedPatternName() {
        return matchedPatternName;
    }
}
