Skip to content

Conversation

@dodo920306
Copy link
Contributor

Previously, api.common.response.err() in api-engine was used in two contexts:

  1. To pass plain error messages (strings).
  2. To pass Exception.args from the API engine, which is a Python tuple.

Since JavaScript’s template strings call .toString() on non‑string values, passing a tuple resulted in [object Object] in the UI.

This change normalizes the error payload so that:

  • Strings pass through unchanged.
  • Arrays and objects are serialized via JSON.stringify().
  • Other types are converted with String().

As a result, all error messages should display correctly in the frontend without [object Object] artifacts.

Previously, `api.common.response.err()` in api-engine was used in two contexts:
1. To pass plain error messages (strings).
2. To pass `Exception.args` from the API engine, which is a Python tuple.

Since JavaScript’s template strings call `.toString()` on non‑string values, passing
a tuple resulted in "[object Object]" in the UI.

This change normalizes the error payload so that:
- Strings pass through unchanged.
- Arrays and objects are serialized via `JSON.stringify()`.
- Other types are converted with `String()`.

As a result, all error messages should display correctly in the frontend without
"[object Object]" artifacts.

Signed-off-by: dodo920306 <[email protected]>
Users don't want/need to know what API causes the error. They should only be shown
the message.

Signed-off-by: dodo920306 <[email protected]>
@yeasy yeasy merged commit d45c9c3 into hyperledger-cello:main Jun 23, 2025
3 checks passed
@dodo920306 dodo920306 deleted the fix/error-msg-shown-as-object-object branch June 25, 2025 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants