mirror of
https://github.com/penpot/penpot.git
synced 2026-09-30 07:46:16 +00:00
🐛 Raise validation error for incompatible binfile export options (#10341)
Requesting a binfile export with both `include-libraries` and `embed-assets` enabled threw a raw `IllegalArgumentException`, which the RPC layer surfaced to API clients as a generic `:server-error`/`:unexpected` (HTTP 500) with no actionable code -- the opaque failure reported in #7649 (perceived as an "empty" export). The two options are genuinely mutually exclusive, so the request is invalid input, not a server fault. Replace the raw throw in both the v1 and v3 export paths with `ex/raise :type :validation :code :incompatible-options`, matching how the rest of the binfile code reports bad input. Also fix the "mutally" -> "mutually" typo in the hint. Verified on a local devenv: the export RPC now returns `{:type :validation :code :incompatible-options}` instead of a 500, and valid single-option exports are unaffected. Adds a regression test. Fixes #7649 Signed-off-by: Filip Sajdak <filip.sajdak@siili.com> Signed-off-by: Andrey Antukh <niwi@niwi.nz> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
cb64570f13
commit
773fc2295e
@ -305,8 +305,9 @@
|
|||||||
(defn write-export!
|
(defn write-export!
|
||||||
[{:keys [::bfc/include-libraries ::bfc/embed-assets] :as cfg}]
|
[{:keys [::bfc/include-libraries ::bfc/embed-assets] :as cfg}]
|
||||||
(when (and include-libraries embed-assets)
|
(when (and include-libraries embed-assets)
|
||||||
(throw (IllegalArgumentException.
|
(ex/raise :type :validation
|
||||||
"the `include-libraries` and `embed-assets` are mutally excluding options")))
|
:code :incompatible-options
|
||||||
|
:hint "the `include-libraries` and `embed-assets` are mutually exclusive options"))
|
||||||
|
|
||||||
(write-export cfg))
|
(write-export cfg))
|
||||||
|
|
||||||
|
|||||||
@ -222,8 +222,9 @@
|
|||||||
[{:keys [::bfc/embed-assets ::bfc/include-libraries] :as cfg} file-id]
|
[{:keys [::bfc/embed-assets ::bfc/include-libraries] :as cfg} file-id]
|
||||||
|
|
||||||
(when (and include-libraries embed-assets)
|
(when (and include-libraries embed-assets)
|
||||||
(throw (IllegalArgumentException.
|
(ex/raise :type :validation
|
||||||
"the `include-libraries` and `embed-assets` are mutally excluding options")))
|
:code :incompatible-options
|
||||||
|
:hint "the `include-libraries` and `embed-assets` are mutually exclusive options"))
|
||||||
|
|
||||||
(let [detach? (and (not embed-assets) (not include-libraries))]
|
(let [detach? (and (not embed-assets) (not include-libraries))]
|
||||||
(db/tx-run! cfg (fn [cfg]
|
(db/tx-run! cfg (fn [cfg]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user