result.fail
A failed result with one diagnostic built from a catalogue code.
Usage
Result.fail<T = never>(code: KernelDiagnosticCode, message: string, details?: KernelDiagnosticDetails): Result<T>Parameters
codeKernelDiagnosticCodeThe stable catalogue code, e.g.
GEOMETRY_INPUT_INVALID.messagestringWhat went wrong, for a human; codes are the contract, messages may be reworded.
detailsKernelDiagnosticDetailsWhere and what:
paramPath,entities,measured,suggestedFixes,severity. Default{}.
Returns
{ ok: false, diagnostics: [d] } with d.code === code; the severity is the code’s catalogue default unless details.severity overrides it.
Use instead
result.failWith: the diagnostics already exist, e.g. passed up from a step
Example
Result.fail('GEOMETRY_INPUT_INVALID', 'radius must be positive').diagnostics[0].code // → 'GEOMETRY_INPUT_INVALID'