apache / apache/rocketmq-dashboard
[Studio][Bug] Instance create and edit dialogs hide the server error reason
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 683
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 58
Description
## 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: "}` 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: ".
## 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: #4241.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in web/src/pages/instance/index.tsx by reading handleCreate and handleUpdate alongside the existing handleDelete, handleBatchDelete, and handleImportAll error handling. Done means create and update failures show the server message when present and retain the generic localized fallback when it is absent; verify with the duplicate-name reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100