result.failWith

A failed result carrying diagnostics that already exist.

Value helperSince 0.3.0

Usage

TypeScript
Result.failWith<T = never>(first: KernelDiagnostic, ...rest: KernelDiagnostic[]): Result<T>

Parameters

  • firstKernelDiagnostic

    The leading diagnostic; a failure always has at least one.

    Required

  • restKernelDiagnostic[]

    Further diagnostics, in order.

    Required

Returns

{ ok: false, diagnostics: [first,...rest] }, the diagnostics unchanged.

Example

TypeScript
const d = Result.fail('GEOMETRY_OP_FAILED', 'no hull').diagnostics[0]
Result.failWith(d).ok // → false

See also