Skip to main content
Version: v0.0.8

Variable: SCRIPT_WARNING_MESSAGES

const SCRIPT_WARNING_MESSAGES: Readonly<Record<ScriptWarningCode, string>>

The frozen message registry: one fixed sentence per SCRIPT warning code, and the only source a warning's message can come from.

This is the mechanism, not a convention. scriptWarning takes no value parameter at all, so there is no interpolation site for a document-derived string to reach: a message is a table lookup or it does not exist. Everything a consumer needs to locate the problem travels in the code and the ScriptPosition, whose path is built from element names this parser recognizes rather than from names a sender chose.

Example

import { SCRIPT_WARNING_CODES, SCRIPT_WARNING_MESSAGES } from "@cosyte/ncpdp/common";
SCRIPT_WARNING_MESSAGES[SCRIPT_WARNING_CODES.VERSION_ABSENT];
// "No SCRIPT version declared; parsed best-effort."