import { classifyFailoverReason } from "./reason.js";
//#region src/agent/fallback/error.ts
var FailoverError = class extends Error {
	constructor(message, reason, provider, model, status, code, cause) {
		super(message, { cause });
		this.reason = reason;
		this.provider = provider;
		this.model = model;
		this.status = status;
		this.code = code;
		this.name = "FailoverError";
	}
};
function isFailoverError(err) {
	return err instanceof FailoverError;
}
function describeFailoverError(err) {
	if (isFailoverError(err)) return {
		message: err.message,
		reason: err.reason,
		status: err.status,
		code: err.code
	};
	return {
		message: String(err),
		reason: classifyFailoverReason(err)
	};
}
//#endregion
export { FailoverError, describeFailoverError, isFailoverError };

//# sourceMappingURL=error.js.map