zjncs opened a new pull request, #5715:
URL: https://github.com/apache/rocketmq-dashboard/pull/5715

   ### What
   
   `ToolExceptionHandler` — the `@RestControllerAdvice` that keeps every tool 
entry point (`ToolController`, `McpToolController`) answering the same 
structured error shape — had no test. This adds `ToolExceptionHandlerTest` with 
5 tests.
   
   ### Why
   
   The advice is what turns a tool failure into the three-field error body — 
machine `code`, human `message`, recovery `hint` — instead of a raw stack 
trace, and it is the difference between a 400 and a 500 for the same ToolError. 
Nothing pinned any of it.
   
   ### What is pinned
   
   - a **client** tool failure keeps its own HTTP status (400) and carries the 
machine error code (`INVALID_ARGUMENT`), the human message, and the recovery 
hint;
   - a **server** tool failure maps to its own status (500) with the 
`INTERNAL_ERROR` code;
   - an unreadable body becomes the structured `INVALID_ARGUMENT` body error;
   - a missing parameter **names the parameter it wants** (`Missing required 
tool parameter: instanceId`);
   - a type mismatch **names the parameter it could not convert** (`Invalid 
tool parameter: page`).
   
   ### Verification
   
   - New tests on unmodified code: **5/5 green**, checkstyle clean (`mvn test 
-Dtest=ToolExceptionHandlerTest`).
   - Discriminating mutations on `ToolExceptionHandler`, build result verified 
red each time:
     1. the response status hardcoded to 500 regardless of the failure — red;
     2. the body `code` field carrying the numeric HTTP status instead of the 
machine error code — red;
     3. the missing-parameter handler mapped to the wrong template (INVALID 
instead of REQUIRED) — red.
   - Restored: 5/5 green. Test-only change; no product code touched.
   


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