mirror of
https://github.com/penpot/penpot.git
synced 2026-03-14 14:27:11 +00:00
🐛 Fix unhandled AbortError in HTTP fetch requests
Identify and silence "signal is aborted without reason" errors by: - Providing an explicit reason to AbortController when subscriptions are disposed. - Updating the global error handler to ignore AbortError exceptions. - Ensuring unhandled rejections use the ignorable exception filter. The root cause was RxJS disposal calling .abort() without a reason, combined with the on-unhandled-rejection handler missing the ignorable error filter. Signed-off-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
@@ -343,7 +343,12 @@
|
||||
(= message "Possible side-effect in debug-evaluate")
|
||||
(= message "Unexpected end of input")
|
||||
(str/starts-with? message "invalid props on component")
|
||||
(str/starts-with? message "Unexpected token "))))
|
||||
(str/starts-with? message "Unexpected token ")
|
||||
;; Abort errors are expected when an in-flight HTTP request is
|
||||
;; cancelled (e.g. via RxJS unsubscription / take-until). They
|
||||
;; are handled gracefully inside app.util.http/fetch and must
|
||||
;; NOT be surfaced as application errors.
|
||||
(= (.-name ^js cause) "AbortError"))))
|
||||
|
||||
(on-unhandled-error [event]
|
||||
(.preventDefault ^js event)
|
||||
|
||||
@@ -123,10 +123,15 @@
|
||||
(/ current-time (inc count)))
|
||||
count (inc count)]
|
||||
(swap! network-averages assoc (:path uri) {:count count :average average})))))
|
||||
|
||||
(fn []
|
||||
(vreset! unsubscribed? true)
|
||||
(when @abortable?
|
||||
(.abort ^js controller)))))))
|
||||
;; Provide an explicit reason so that the resulting AbortError carries
|
||||
;; a meaningful message instead of the browser default
|
||||
;; "signal is aborted without reason".
|
||||
(.abort ^js controller (ex-info (str "fetch to '" uri "' is aborted")
|
||||
{:uri uri}))))))))
|
||||
|
||||
(defn response->map
|
||||
[response]
|
||||
|
||||
Reference in New Issue
Block a user