Getting Started

Error Handling

MUDBASE uses standard HTTP status codes and structured error objects for all error responses.

Error Response Format

Every error is a flat JSON object - code is the stable, machine-matchable identifier; error and message are both human-readable (kept separate so you can show message to end users while logging error/code):

jsonError Response
{
  "error": "Rate limit exceeded",
  "code": "RATE_LIMITED",
  "message": "Too many requests. Retry after the period in the Retry-After header."
}
{
  "error": "Rate limit exceeded",
  "code": "RATE_LIMITED",
  "message": "Too many requests. Retry after the period in the Retry-After header."
}

The HTTP status itself (not a field in the body) tells you the response category - see Error Explorer for the full list of named code values, which endpoints return each one, and the HTTP status paired with it.

SDK Error Handling

There is no custom error class - the SDK is a generated Axios client, so a failed request throws a normal AxiosError with the response body above at err.response.data:

javascript
import axios from "axios";

try {
  const { data: result } = await data.createData({
    projectId,
    collectionId,
    body: { item: "espresso" },
  });
} catch (err) {
  if (axios.isAxiosError(err) && err.response) {
    const { code, message } = err.response.data; // { error, code, message }
    console.error(code);              // 'RATE_LIMITED'
    console.error(err.response.status); // 429 - from the HTTP response, not the body
    console.error(message);

    if (err.response.status === 429) {
      await sleep(30_000);
    }
  }
}
import axios from "axios";

try {
  const { data: result } = await data.createData({
    projectId,
    collectionId,
    body: { item: "espresso" },
  });
} catch (err) {
  if (axios.isAxiosError(err) && err.response) {
    const { code, message } = err.response.data; // { error, code, message }
    console.error(code);              // 'RATE_LIMITED'
    console.error(err.response.status); // 429 - from the HTTP response, not the body
    console.error(message);

    if (err.response.status === 429) {
      await sleep(30_000);
    }
  }
}

Last updated: September 2026

Edit this page on GitHub
Chat with us