result.error

The first error diagnostic of a failure.

Value helperSince 0.3.0

Usage

TypeScript
Result.error<T>(r: Result<T>): KernelDiagnostic | undefined

Parameters

  • rResult<T>

    The result to read.

    Required

Returns

The first diagnostic of severity error, else the first diagnostic of the failure; undefined for a success.

Example

TypeScript
Result.error(Result.fail('GEOMETRY_OP_FAILED', 'no hull')).code // → 'GEOMETRY_OP_FAILED'
Result.error(Result.ok(1)) // → undefined

See also