gnodet-bot commented on code in PR #28209:
URL: https://github.com/apache/camel/pull/28209#discussion_r4333442064


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringTools.java:
##########
@@ -1701,8 +1701,9 @@ public static JsonObject writeFile(ToolContext ctx, Path 
dir, String file, Strin
                           + (output.size() > 1 ? " (and " + (output.size() - 
1) + " more in reload.output)" : "");
             }
             final String loggedAfter = logged;
+            String reloadedWhat = SourceValidator.isValidatableFile(file) ? 
"the file" : "its routes, which load the file";
             result.put("message", switch (status) {
-                case "reloaded" -> "The running integration reloaded the 
file." + loggedAfter;
+                case "reloaded" -> "The running integration reloaded " + 
reloadedWhat + "." + loggedAfter;
                 case "properties" -> "The running integration reloaded the 
properties.";
                 case "failed" -> "The running integration FAILED to reload the 
file, the route is not running; fix the"
                                  + " content and write again (see 
reload.message).";

Review Comment:
   💡 The `"reloaded"` case at line 1706 correctly uses `reloadedWhat` to 
describe what was reloaded ("the file" vs "its routes, which load the file"), 
but the `"failed"` case still hardcodes `"the file"` for both route files and 
route-resource files (`.groovy`, `.js`, etc.). For a script the routes load, 
the failure is on the route that loads it, not the script itself — using 
`reloadedWhat` here would be consistent.
   
   ```suggestion
                   case "failed" -> "The running integration FAILED to reload " 
+ reloadedWhat + ", the route is not running; fix the"
                                    + " content and write again (see 
reload.message)."
   ```



-- 
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