binaryage / binaryage/cljs-devtools

Catching uncatchables

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
idea
Dominant language
Clojure
Stars
1.1k
Forks
51
PR merge metrics
No merged PRs in 30d

Description

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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.