mirror of
https://github.com/penpot/penpot.git
synced 2026-07-04 05:15:08 +00:00
The plugin proxy `:on-error` handler funneled every throwable through `handle-error`, which only produced a message for malli ExceptionInfo carrying `::sm/explain`. Two paths lost the real cause and rendered the unhelpful "[PENPOT PLUGIN] Value not valid. Code: :error": - A plain JS error (TypeError, etc.) is not an ExceptionInfo, so `(ex-data cause)` is nil and the message bound to nil; the real `.-message` only reached the host-page console, invisible to the plugin sandbox. - A malli explain whose errors flatten to nothing made `error-messages` return "", which rendered as "Value not valid: . Code: :error". `error-messages` now returns nil (not "") when there is nothing to render, and `handle-error` falls back to the raw explain, then to the throwable's `ex-message`/`str`, so a useful message always surfaces. Working cases (well-formed explain) are unchanged. Adds regression tests for the plain-JS-error path, the empty-explain path, and the `error-messages` nil contract. Fixes #9692 Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>