← All packages

API reference

@searsuite/sear-foundation-error

Structured public errors with stable codes and diagnostic details.

2 exportsderived from source

classSearErrorsource ↗
class SearError extends Error

Base class for errors intentionally exposed by SearSuite packages.

Packages may throw this generic form while they do not need a more specific public error type. Domain-specific subclasses override code.

constructorconstructor
SearError(message: string, details?: SearErrorDetails, options?: ErrorOptions): SearError

Creates a SearError instance.

message: string
details: SearErrorDetails
options: ErrorOptions
propertycode
readonly code: string

Stable machine-readable identifier for this error category.

propertydetails
readonly details: SearErrorDetails
methodreport
report(): this

Reports this error with a compact, styled console header and diagnostics. Returning the error keeps throw new SearError(...).report() ergonomic.

Inherited members 7
  • cause
  • message
  • name
  • stack
  • stackTraceLimit
  • captureStackTrace
  • prepareStackTrace
typeSearErrorDetailssource ↗
type SearErrorDetails = Readonly<Record<string, unknown>>

Machine-readable context attached to framework errors.