@mocanvas/mocanvas · type

TldrawFileParseError

type TldrawFileParseError = {
    type: "notATldrawFile";
    cause: unknown;
} | {
    type: "v1File";
    data: unknown;
} | {
    type: "invalidRecords";
    cause: unknown;
} | {
    type: "migrationFailed";
    reason: string;
} | {
    type: "fileFormatVersionTooNew";
    version: number;
}

Why a file could not be read.

A discriminated union rather than an Error because every case calls for a different response: a v1 file can be converted, a file from a newer build can be reported by version, and invalid records can name what was wrong. Each variant carries only what its own case needs.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.