?
MindStudioInterfaceError
TypeThe error thrown when a client call fails, identified by a `code` that names the cause.
The error class thrown by a failed method call, and by the upload and configuration helpers. Its code names the cause: a missing method, a method that threw, or a stream that ended early. status carries the HTTP status when the failure came from the server.
MindStudioInterfaceError.ts
class MindStudioInterfaceError extends Error {
readonly code: string
readonly status?: number
}Fields
code
string
ReadonlyMachine-readable cause, for example method_not_found, method_error, stream_incomplete, or not_initialized.
status?
number
ReadonlyThe HTTP status, present when the failure came back from a method response.
Branch on the code
import { createClient, MindStudioInterfaceError } from '@mindstudio-ai/interface'; try { await api.submitVendorRequest({ name }); } catch (err) { if (err instanceof MindStudioInterfaceError && err.code === 'method_error') { setError('The request could not be completed.'); } else { throw err; } }