The Coline App SDK: apps, tools, file types and surfaces that run inside Coline workspaces, and public websites with Coline Sites. TypeScript, with an in-memory test workspace. MIT.
| 4 | readonly type: ColineApiErrorType; |
| 5 | readonly status: number; |
| 6 | readonly code: string | null; |
| 7 |
| 8 | constructor(params: { |
| 9 | message: string; |
| 10 | type: ColineApiErrorType; |
| 11 | status: number; |
| 12 | code?: string | null; |
| 13 | }) { |
| 14 | super(params.message); |
| 15 | this.name = "ColineApiError"; |
| 16 | this.type = params.type; |
| 17 | this.status = params.status; |
| 18 | this.code = params.code ?? null; |
| 19 | } |
| 20 |
| 21 | /** Whether this error is safe to retry (rate limit or server error). */ |
| 22 | get isRetryable(): boolean { |
| 23 | return this.status === 429 || this.status >= 500; |
| 24 | } |
| 25 | } |
| 26 |
| 27 | export function isColineApiError(value: unknown): value is ColineApiError { |
| 28 | return value instanceof ColineApiError; |
| 29 | } |
| 30 |