//#region src/client/stream/error.ts
/**
* Error wrapper for protocol-level error responses returned by the server.
*/
var ProtocolError = class extends Error {
	code;
	response;
	constructor(response) {
		super(response.message);
		this.name = "ProtocolError";
		this.code = response.error;
		this.response = response;
	}
};
/**
* Thrown when the v2 WebSocket transport exhausts its automatic reconnect
* budget (`maxReconnectAttempts`) after an unexpected socket close or error.
*
* The transport closes its event queue with this error so consumers of
* `events()` can treat the stream as terminally failed. Set
* `maxReconnectAttempts` to `0` on `client.threads.stream({ transport:
* "websocket" })` to disable reconnect and fail fast on the first drop
* instead.
*/
var MaxWebSocketReconnectAttemptsError = class extends Error {
	/** The configured `maxReconnectAttempts` value that was exceeded. */
	maxAttempts;
	constructor(maxAttempts, cause) {
		super(`Exceeded maximum WebSocket reconnection attempts (${maxAttempts})`);
		this.name = "MaxWebSocketReconnectAttemptsError";
		this.maxAttempts = maxAttempts;
		this.cause = cause;
	}
};
//#endregion
export { MaxWebSocketReconnectAttemptsError, ProtocolError };

//# sourceMappingURL=error.js.map