Skip to main content
Version: v0.0.2

Function: detectionError()

detectionError(detected): CliError

Build the value-free CliError for a non-certain detection: the data error the caller returns instead of guessing a parser. ambiguous names the matching candidates (a value-free code list); none asks for --format. Both map to the data-error exit (65). Never echoes input bytes.

Parameters

detected

DetectResult

A DetectResult whose format is null (i.e. not certain).

Returns

CliError

A value-free CLI_FORMAT_AMBIGUOUS or CLI_FORMAT_UNDETECTED error.

Example

import { classifyCandidates, detectionError } from "@cosyte/cli";

detectionError(classifyCandidates([])).code; // => "CLI_FORMAT_UNDETECTED"
detectionError(classifyCandidates(["hl7", "fhir"])).code; // => "CLI_FORMAT_AMBIGUOUS"