cello icon indicating copy to clipboard operation
cello copied to clipboard

Ensure error message stringified safely

Open dodo920306 opened this issue 6 months ago • 0 comments

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.

dodo920306 avatar Jun 14 '25 14:06 dodo920306