UNPKG

@forbespro/lead-agent

Version:
4 lines (3 loc) 1.6 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var i="vercel.ai.error",p=Symbol.for(i),l,I=class m extends Error{constructor({name:r,message:e,cause:s}){super(e),this[l]=!0,this.name=r,this.cause=s}static isInstance(r){return m.hasMarker(r,i)}static hasMarker(r,e){const s=Symbol.for(e);return r!=null&&typeof r=="object"&&s in r&&typeof r[s]=="boolean"&&r[s]===!0}};l=p;var t=I;function o(a){return a==null?"unknown error":typeof a=="string"?a:a instanceof Error?a.message:JSON.stringify(a)}var u="AI_InvalidArgumentError",v=`vercel.ai.error.${u}`,b=Symbol.for(v),c,h=class extends t{constructor({message:a,cause:r,argument:e}){super({name:u,message:a,cause:r}),this[c]=!0,this.argument=e}static isInstance(a){return t.hasMarker(a,v)}};c=b;var y="AI_JSONParseError",E=`vercel.ai.error.${y}`,k=Symbol.for(E),g,A=class extends t{constructor({text:a,cause:r}){super({name:y,message:`JSON parsing failed: Text: ${a}. Error message: ${o(r)}`,cause:r}),this[g]=!0,this.text=a}static isInstance(a){return t.hasMarker(a,E)}};g=k;var f="AI_TypeValidationError",S=`vercel.ai.error.${f}`,M=Symbol.for(S),d,T=class n extends t{constructor({value:r,cause:e}){super({name:f,message:`Type validation failed: Value: ${JSON.stringify(r)}. Error message: ${o(e)}`,cause:e}),this[d]=!0,this.value=r}static isInstance(r){return t.hasMarker(r,S)}static wrap({value:r,cause:e}){return n.isInstance(e)&&e.value===r?e:new n({value:r,cause:e})}};d=M;var _=T;exports.AISDKError=t;exports.InvalidArgumentError=h;exports.JSONParseError=A;exports.TypeValidationError=_;exports.getErrorMessage=o;