cello
cello copied to clipboard
Ensure error message stringified safely
Previously, api.common.response.err() in api-engine was used in two contexts:
- To pass plain error messages (strings).
- To pass
Exception.argsfrom 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.