Skip to main content

Errors

Every error the SDK raises extends PlaneError, and every class below is exported from the package root.

ErrorRaised byWhen
PlaneApiErrorv2the API answered an error: an RFC 9457 problem detail
NoMatchFoundErrorv2a findBy* lookup matched nothing
MultipleMatchesFoundErrorv2a findBy* lookup matched more than one row
PlaneNetworkErrorv2the request never reached a server: connection refused, DNS failure, timeout, …
MissingPathIdErrorv2a URL cannot be built because a path id is missing
HttpErrorv1a v1 request failed: the status code, the response body and the response headers
AttachmentTooLargeErrorv1workItems.attachments.download passed its maxBytes

All seven extend PlaneError directly. In particular the lookup errors are not subclasses of PlaneApiError, so catching that alone does not catch them.

PlaneApiError​

PlaneApiError carries the problem detail as .status, .type, .code, .detail and .errors, the last being the per-field validation errors when the server sent them.

import { PlaneApiError, PlaneNetworkError } from "@hoyasumii/plane";

try {
await client.v2.workspaces.projects.states.create("acme", "ENG", { name: "", color: "#000000" });
} catch (error) {
if (error instanceof PlaneApiError) {
console.log(error.status, error.code, error.detail, error.errors);
} else if (error instanceof PlaneNetworkError) {
console.log("unreachable:", error.message, error.cause);
} else {
throw error;
}
}

A bulk write answers HTTP 200 even when rows fail. v2.raiseForFailures(result) turns a failure into a PlaneApiError (see Memberships and bulk writes).