On this page

RuntimeError

Understand the nominal base shared by SER-authored JavaScript errors.

What this error means and what can trigger it

RuntimeError is the common JavaScript base class for SER-authored runtime and compiler exceptions. It preserves the native Error stack and message while giving direct instances the stable name RuntimeError. Concrete subclasses replace that name with their own class name and may add structured fields.

Production code does not construct RuntimeError directly, so there is no standalone runtime trigger to find. You encounter the base through subclasses such as PreprocessError, DispatcherDisposedError, and RuntimeAlreadyInitializedError.

The base adds no cause, error code, tagged-data protocol, or effect failure behavior. A subclass may be thrown synchronously, placed in a Promise rejection, or supplied to Effect.fail; inheritance alone says nothing about how the error reaches you.

Exactly where it triggers

Since production code never instantiates the base directly, there is no trigger site to point to. Its declaration is:

export class RuntimeError extends Error {
	constructor(message: string) {
		super(message);
		this.name = "RuntimeError";
	}
}

The only direct new RuntimeError(...) in current source is the documentation example above the class. Reporting that example as a production throw would be inaccurate.

Why this is the case

The base gives integration code a nominal boundary for errors authored by SER while allowing each invariant to keep a precise class and fields. It also avoids turning tagged remote failures such as RemoteHttpError into JavaScript exceptions merely for inheritance.

Because the class represents no single invariant, production code selects a concrete subclass at each failure site. Catching only the base is intentionally broad and loses the detail that identifies the failed subsystem.