binaryage / binaryage/cljs-devtools

Catching uncatchables

Aperta
#36 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
idea
Lingua principale
Clojure
Stelle
1.1k
Fork
51
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

We were having trouble with spec errors in EventListeners. For example, spec errors thrown when handling the response to an ajax request were uncaught and printed badly.

There are Closure Library functions which can help with these cases. Possibly of use for cljs-devtools

```
(ns condense.preload
(:require [goog.debug.entryPointRegistry :as gepr])
(:import [goog.debug ErrorHandler]))

(defn handle-error [e]
(js/console.debug (.-stack e))
(js/console.debug (ex-data e)))

(def error-handler (doto (ErrorHandler. handle-error)
(.protectWindowSetTimeout)
(.protectWindowSetInterval)
(.protectWindowRequestAnimationFrame)))

(gepr/monitorAll error-handler)
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.