eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 441 B
JavaScript
import{isObject}from"#shared/guards.js";var ClientError=class extends Error{code;status;body;headers;constructor(e,t,n){let r=t||`Server returned ${e}.`,i;try{let e=JSON.parse(t);isObject(e)&&(typeof e.error==`string`&&(r=e.error),typeof e.code==`string`&&(i=e.code))}catch{}super(r),this.name=`ClientError`,this.code=i,this.status=e,this.body=t,this.headers=Object.freeze(Object.fromEntries(new Headers(n).entries()))}};export{ClientError};