class PluginErrorException
extends Error

Throw this (instead of a plain throw new Error(...)) to report a PluginError through an exception rather than a return {error} — used for the exact same "expected, semantic failure" cases MetadataResult.error documents, just from a code path that's more naturally a throw (deep inside a helper, a caught-and-rethrown parse failure, etc.) than a return. The dispatcher (dispatcher.ts's handleRequest) special-cases this class specifically — an unexpected throw of anything else (a genuine bug, a network library's own exception type) still degrades to today's generic unstructured-fault handling, since an arbitrary caught value has no stable translatable shape to extract error_code/data from.

Constructors

PluginErrorException(
error_code: string,
data?: Record<string, string | number>
)

Usage

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