|
| 1 | +# CMOD error reporting |
| 2 | + |
| 3 | +CMOD writes diagnostics to standard error. LASSIE's Process Output window |
| 4 | +already displays that stream and marks failed processes in red. |
| 5 | + |
| 6 | +| Exit code | Meaning | |
| 7 | +| --- | --- | |
| 8 | +| 0 | The requested build completed. | |
| 9 | +| 1 | A diagnosed project-input or output failure. | |
| 10 | +| 2 | An unexpected C++ exception or a diagnosed internal error. | |
| 11 | + |
| 12 | +For example, a missing configuration field produces: |
| 13 | + |
| 14 | +```text |
| 15 | +CMOD project error: A required project setting is missing. |
| 16 | +Project: Example.dissco |
| 17 | +Context: ProjectConfiguration.NumberOfChannels |
| 18 | +Suggestion: Restore this setting in Project Properties, then save the project in LASSIE. |
| 19 | +Build failed. |
| 20 | +``` |
| 21 | + |
| 22 | +Project diagnostics cover unreadable or malformed project XML, missing or invalid |
| 23 | +configuration, invalid numeric expressions and nested functions, missing object |
| 24 | +references, invalid Select indices, functions used without an event context, |
| 25 | +invalid child counts, and empty score staffs. Output diagnostics cover directory |
| 26 | +creation, temporary library files, audio/score writes, and LilyPond failures. |
| 27 | +Unexpected C++ exceptions ask the user to send developers the project, seed, |
| 28 | +and diagnostic. Hard process faults and remaining legacy direct-exit paths |
| 29 | +retain their existing handling; they are not made recoverable by these exceptions. |
| 30 | + |
| 31 | +## Adding a diagnostic |
| 32 | + |
| 33 | +Throw `CmodError` with a category, a specific reason, input context, and a |
| 34 | +corrective action. Add outer context while rethrowing at a boundary that knows |
| 35 | +the project field or expression. Do not discard an underlying parser's reason, |
| 36 | +or classify an arbitrary `std::exception` as a user-input error. |
| 37 | + |
| 38 | +`Main.cpp` reports the exception once and returns a nonzero exit code. A failed |
| 39 | +run must not reach its `Build complete.` message. |
0 commit comments