unbridled-41 opened a new pull request, #5928:
URL: https://github.com/apache/rocketmq-dashboard/pull/5928

   ### Which Issue(s) This PR Fixes
   
   Fixes #5927
   
   ### Problem / Evidence
   
   `getBusinessError` reads `code`/`message` off a parsed object, but axios 
hands the body of a `responseType: 'blob'` request back as a Blob, so the 
interceptor saw no envelope:
   
   ```
   BLOB error.message      : "Request failed with status code 501"
   JSON twin error.message : "DLQ operations are not supported for cloud 
instances"
   ```
   
   Reproduced against the real modules with the server's own answers 
(`DLQService` 501/400, `AuditService` 400):
   
   ```
   client.test.ts: extracts the backend message from a rejected blob export
   AssertionError: ... expected 'Request failed with status code 501' to equal 
'DLQ operations are not supported for cloud instances'
   ```
   
   Affected call sites are the ones that use `responseType: 'blob'`: the DLQ 
Excel export, the alert-rule asset export and the metrics/Grafana exports. 
Their refusals are concrete facts the operator needs, and each caller already 
routes the rejected error through `describeThrownMessage`, so the loss surfaces 
as a generic fallback.
   
   ### Root cause / Fix
   
   The envelope extractor assumed a JSON body. When the response is a Blob, 
read its text and run the same `getBusinessError`; if it cannot be read or 
carries no envelope, leave the transport error untouched.
   
   ### Priority and scoring
   
   **PRIORITY 52** — impact 16/40 (a lost reason on an error path; no data 
change), blast radius 16/20 (shared plumbing: every blob export in the app), 
reproducibility 20/20 (deterministic, pinned by the new test), maintenance 
value 8/20.
   
   **FIX_CONFIDENCE 88** — one extra branch in one handler, with a guard test 
for the non-JSON body.
   
   ### Tests
   
   `cd web && npx vitest run src/api/` -> `Test Files 30 passed (30), Tests 249 
passed (249)`.
   
   | Test | Before | After |
   |---|---|---|
   | `extracts the backend message from a rejected blob export` | FAIL 
(`Request failed with status code 501`) | PASS |
   | `keeps the transport error when a rejected blob carries no envelope` | 
PASS | PASS (guards that a non-JSON body still surfaces axios's message and 
shows no toast) |
   
   `npx eslint` reports no errors; `npx tsc -b` passes.
   
   ### Risk
   
   The interceptor's rejection path is now `async` (it already returned a 
promise); a Blob body that is not JSON falls back to today's behaviour.


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