Skip to main content

Interface: IErrorService

Defined in: src/types/services.ts:357

Provider-agnostic error reporting service.

Matches the client SDK's IErrorReporter shape plus host-only concerns (setUser, setDefaultMetadata). Host UI components access this via IRuntimeServices.error or useRuntimeServices().error.

Remarks​

The underlying provider (Bugsnag, Datadog, etc.) is an internal implementation detail of the error reporting adapter. Miniapp code uses the equivalent handlers.reportError() and handlers.reportBreadcrumb() from the client SDK.

Example​

const services = useRuntimeServices();
services.error?.reportError(new Error("Something failed"), "warning");
services.error?.reportBreadcrumb("user-action", { button: "save" });

Methods​

reportBreadcrumb()​

reportBreadcrumb(message, metadata?): void

Defined in: src/types/services.ts:372

Leave a breadcrumb for error context. Breadcrumbs are attached to the next error report by the monitoring service.

Parameters​

message​

string

Short description of the event (e.g. "user-login", "api-call")

metadata?​

Record<string, unknown>

Arbitrary key-value data attached to the breadcrumb

Returns​

void


reportError()​

reportError(error, severity?): void

Defined in: src/types/services.ts:364

Report an error to the monitoring service.

Parameters​

error​

string | Error

The error to report. Strings are wrapped in new Error().

severity?​

ErrorSeverity

Severity level. Defaults to "error".

Returns​

void


setDefaultMetadata()​

setDefaultMetadata(section, values): void

Defined in: src/types/services.ts:387

Set default metadata attached to all future error reports. Auto-called by the runtime with miniapp identity on bootstrap.

Parameters​

section​

string

Metadata section name (e.g. "miniapp", "session")

values​

Record<string, unknown>

Key-value pairs to attach

Returns​

void


setUser()​

setUser(user): void

Defined in: src/types/services.ts:379

Set user identity for error attribution. Auto-called by the runtime when auth state changes — typically not called manually.

Parameters​

user​

User identity fields

id?​

string

name?​

string

Returns​

void