| import { AISDKError } from './ai-sdk-error'; | |
| import { getErrorMessage } from './get-error-message'; | |
| const name = 'AI_JSONParseError'; | |
| const marker = `vercel.ai.error.${name}`; | |
| const symbol = Symbol.for(marker); | |
| export class JSONParseError extends AISDKError { | |
| private readonly [symbol] = true; // used in isInstance | |
| readonly text: string; | |
| constructor({ text, cause }: { text: string; cause: unknown }) { | |
| super({ | |
| name, | |
| message: | |
| `JSON parsing failed: ` + | |
| `Text: ${text}.\n` + | |
| `Error message: ${getErrorMessage(cause)}`, | |
| cause, | |
| }); | |
| this.text = text; | |
| } | |
| static isInstance(error: unknown): error is JSONParseError { | |
| return AISDKError.hasMarker(error, marker); | |
| } | |
| } | |
Xet Storage Details
- Size:
- 734 Bytes
- Xet hash:
- f38a8cfe9323d5ff8c2b6b4887d3ac7efe1513a4e4e810c6ae673a55b3d96d65
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.