Fork me on GitHub
#reagent
<
2019-12-16
>
Hi11:12:24

hi. I am trying to set listener on window.onerror(...) while using Reagent. Is it safe to do so? does reagent maybe use the listener for something else?

p-himik12:12:09

I think you can use addEventListener - it will not override anything.

Hi12:12:32

I have this

(set! (.-onerror js/window)  
      (fn [message source lineno colno error]  
        (timbre/error "Error caught .onerror: " message source lineno colno (js->clj error))))

(.addEventListener js/window "error"
     (fn [error] (timbre/error "Error caught with event listener: " (js->clj error))))

Hi12:12:57

but something else catches the errors when they occur

Hi12:12:56

looks like figwheel or something

p-himik12:12:37

Sorry, I have no idea - I've stopped using figwheel quite some time ago.

Hi12:12:49

what are you using?

p-himik12:12:01

shadow-cljs

Hi12:12:16

everyone uses shadow now 😄

p-himik12:12:25

But that's just because it's great. :)

😎 4