acp-sdk
Version:
Agent Communication Protocol SDK
49 lines (48 loc) • 1.21 kB
JavaScript
class BaseError extends Error {
constructor(message, options) {
super(message, options);
Object.setPrototypeOf(this, new.target.prototype);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
}
}
class FetchError extends BaseError {
constructor(message, response, options) {
super(message, options);
this.response = response;
this.name = "FetchError";
}
}
class SSEError extends BaseError {
constructor(message, response, options) {
super(message, options);
this.response = response;
this.name = "SSEError";
}
}
class HTTPError extends BaseError {
statusCode;
headers;
body;
constructor(response, body) {
super(`HTTPError: status ${response.status}`);
this.name = "HTTPError";
this.statusCode = response.status;
this.headers = response.headers;
this.body = body;
}
}
class ACPError extends BaseError {
error;
code;
constructor(error) {
super(error.message);
this.name = "ACPError";
this.error = error;
this.code = error.code;
}
}
export { ACPError, BaseError, FetchError, HTTPError, SSEError };
//# sourceMappingURL=errors.js.map
//# sourceMappingURL=errors.js.map