Class RichErrorMessages
java.lang.Object
org.ek9lang.compiler.common.RichErrorMessages
Provides rich error messages for AI-assisted development.
These detailed messages are appended to error output when error level E3 is enabled,
helping AI assistants understand and resolve EK9 compilation errors more effectively.
This class is a pure lookup - it contains no state. The decision of whether to
based on the per-compilation error level from CompilerFlags.
Messages are loaded from individual .txt resource files in richErrorMessages/, listed by richErrorMessages/rich-error-manifest.txt. This allows researchers to create alternative message packs without modifying Java code.
Each error code has a rich message containing:
- DIAGNOSIS - what went wrong
- ACTION - steps to resolve
- SEE ALSO - related errors and docs
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetRichMessage(String errorCode) Get the rich message for an error code.static StringgetRichMessageWithExample(String errorCode) The rich message for an error code followed by its[EXAMPLE]section: the error catalogue's compiled failing source and its compiled fixes (ErrorExamples.exampleSection(String)), as plain text.static voidloadMessagePack(Path zipPath) Load alternative rich error messages from a message pack zip file.static voidReset overrides back to empty (for testing).
-
Method Details
-
loadMessagePack
Load alternative rich error messages from a message pack zip file. Messages in the pack override built-in messages; codes not in the pack fall back to the built-in defaults.- Parameters:
zipPath- path to the message pack zip file
-
getRichMessage
-
getRichMessageWithExample
The rich message for an error code followed by its[EXAMPLE]section: the error catalogue's compiled failing source and its compiled fixes (ErrorExamples.exampleSection(String)), as plain text. This is whatek9 -h <CODE>and-E3show; a code the catalogue holds nothing for shows its message unchanged. The example is never part of a message pack - a pack replaces the prose, the catalogue is the code.- Parameters:
errorCode- The error code (e.g., "E07235")- Returns:
- The rich message with its example section, or null if there is no rich message
-
resetOverrides
public static void resetOverrides()Reset overrides back to empty (for testing).
-