Open Studio
Kit

Diagnostics

Diagnostics is the namespace a plugin or adapter uses to build and narrow the structured errors Kubb collects during a build, each carrying a stable code, a severity, and a location.

Diagnostics is the namespace a plugin or adapter uses to build and narrow the structured errors Kubb collects during a build. Throw or return a Diagnostics.Error instead of a bare Error when you want a stable code, a severity, and a location attached.

MemberPurpose
Diagnostics.ErrorConstructs a diagnostic-carrying error with a code, severity, and message
Diagnostics.hasErrorNarrows an array of diagnostics to whether any has severity: 'error'
Diagnostics.isProblemGuards a diagnostic down to the problem kind (as opposed to performance or update)
Diagnostics.isPerformanceGuards a diagnostic down to the performance kind, which carries a per-plugin duration
Diagnostics.isUpdateGuards a diagnostic down to the update kind, emitted when a newer Kubb version is available

See the Diagnostics reference for the full list of stable codes Kubb ships with, and how Diagnostics.hasError and Diagnostics.isProblem are used together after a build.