unbridled-41 opened a new issue, #4239:
URL: https://github.com/apache/rocketmq-dashboard/issues/4239

   ## Problem
   
   The instance create and edit dialogs swallow the server's error reason. Both 
`handleCreate` and `handleUpdate` in `web/src/pages/instance/index.tsx` catch 
request failures and show a generic localized toast (`instance.createFailed` / 
`instance.updateFailed`), while delete, batch-delete, and import on the same 
page use the in-file `describeApiError` helper to surface 
`response.data.message`.
   
   ## Evidence
   
   - `web/src/pages/instance/index.tsx` `handleCreate` catch block: 
`message.error(t('instance.createFailed'))`.
   - Same file, `handleUpdate` catch block: 
`message.error(t('instance.updateFailed'))`.
   - Same file, `handleDelete` / `handleBatchDelete` / `handleImportAll`: 
`message.error(describeApiError(error, ...))` — the established pattern on this 
page.
   - The server reason is meaningful: `DuplicateInstanceNameException` (thrown 
by `InstanceService` when the name exists) serializes as 
`{"code":400,"message":"Instance name already exists: <name>"}` via 
`GlobalExceptionHandler`, and other 400 validation messages (e.g. unreachable 
endpoint) are dropped the same way.
   
   Reproduction: click 添加实例, enter a name that already exists, submit — the 
toast reads "添加实例失败,请稍后重试" instead of "Instance name already exists: <name>".
   
   ## Impact
   
   Duplicate instance names are the most common create failure. The user is 
told only that "something failed", so they cannot tell whether the problem is 
the name, the endpoint, or a transient error — and the same gap hides the 
reason on every update failure.
   
   ## Expected behavior
   
   Create and update failures surface the server-provided message, falling back 
to the generic text only when the response carries none — matching 
delete/import behavior on the same page.
   
   ## Related work
   
   - #2983 / #3009 / #2981 localize feedback toasts for the 
topic/consumer-group pages — different pages, same feedback-quality area; the 
instance create/update paths are not covered.
   - The `describeApiError` helper already exists in this file; no new utility 
is needed.
   
   ## PR
   
   Fix incoming.
   


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