davsclaus opened a new pull request, #30021:
URL: https://github.com/apache/camel/pull/30021

   JIRA: [CAMEL-26931](https://issues.apache.org/jira/browse/CAMEL-26931), item 
8 (the rest: stack trace, `--json`).
   
   ## What changes
   
   **No stack trace before the error.** A syntax error printed the 30-line 
stack trace of the integration on stderr before the ERROR line, which says what 
is wrong. Now a failure with a message prints the message only; a failure 
without a message still prints the trace.
   
   ```
   $ camel eval expression orders --template='${body'
   Using existing running Camel integration to evaluate (pid: 31685)
   ERROR: expected symbol functionEnd but was eol: missing } to close the 
function at location 5
   ${body
        *
   ```
   
   stderr: 37 lines → 5.
   
   **`--json`.** The result is printed as `{"result":"hi"}`, and an error as 
the JSON of an error (`{"status":"error","code":1,"message":"..."}`). A missing 
template, a template file that does not exist, and a Camel version before 4.3 
are now thrown as errors, so they are JSON too; they keep their exit codes (2, 
66, 2).
   
   ## Tests
   
   `EvalExpressionResultTest`:
   - `failedEvaluationIsAnError` now expects no stack trace;
   - new: `failedEvaluationWithoutMessagePrintsTheStackTrace`, `resultAsJson`, 
`templateFileThatDoesNotExistIsNotFound`.
   
   The action command tests, the golden help test (updated for `--json`), and 
the JSON and exit code contract tests are green: 563 tests. Commands metadata 
and the `camel eval expression` doc page are regenerated.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to