PuckCloudError
Thrown by puckCloud() methods when Puck Cloud refuses or fails a request.
import { PuckCloudError } from "@puckeditor/cloud-client";
try {
await puck.pages.create({ path: "/about" });
} catch (error) {
if (error instanceof PuckCloudError && error.statusCode === 400) {
// The path is invalid, or another page has it
}
}Params
| Param | Example | Type | Status |
|---|---|---|---|
statusCode | statusCode: 404 | Number | Required |
message | message: "Puck 404 (Not Found): Page not found" | String | Required |
raw | raw: { status: 404, error: "Page not found" } | Object | null | Required |
statusCode
The HTTP status of the response from Puck Cloud, for example 404 for a missing page.
message
What went wrong, with the reason Puck Cloud gave.
raw
The JSON body of the response, or null if the response has no JSON body.