interface PluginError

A plugin-authored error — error_code doubles as an i18n lookup key (the frontend's apps/frontend/src/i18n/locales/*.json use literal English sentences as keys, not symbolic codes; a missing translation falls back to rendering error_code itself verbatim, i18next's own default behavior). Write error_code as a natural, stable English phrase that does NOT embed any dynamic value (a file path, a URL, an HTTP status code, ...) — those go in data instead, so the same error_code can be looked up and translated regardless of which specific file/URL/status triggered it. E.g. for "Could not open foo.json!", use error_code: "Could not open file" + data: {filepath: "foo.json"}, not the interpolated string itself as the code.

Properties

error_code: string
optional
data: Record<string, string | number>

Interpolation params for the translated string — only strings/numbers (filenames, URLs, other messages, page counts, HTTP status codes: everything this SDK's real plugin corpus actually needs to interpolate), never a richer/nested value.

Usage

import { type PluginError } from "crates/lanrurugi-plugin/dispatcher/plugin-sdk.ts";