re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
kwrooijen 2021-02-05T13:55:37.035200Z

Hey all. I have the following code:

(try
  [[]]
  (catch :default e
    [:div "Default content"]))
But this results in breaking the webpage with an Uncaught Error: Invalid arity: 0 error. Is there any way to catch this so teh the "default content" string is shown?

p-himik 2021-02-05T14:12:01.037300Z

[[]] doesn't throw - you cannot use try/catch here. What throws is some Reagent/React machinery, waaaay down the line. You can try using React's error boundaries that are supported by Reagent.

2021-02-05T14:14:31.037800Z

You could also use [(throw (ex-msg "BOOM!"))] instead of [[]] if youโ€™re just trying to exercise your try/catch. See also the js/window.onerror property.

kwrooijen 2021-02-05T14:16:15.038Z

I'll try the react error boundary, thanks!

borkdude 2021-02-05T14:16:19.038200Z

๐ŸŽ‰ 6
2
kwrooijen 2021-02-05T14:24:10.038400Z

Works like a charm, thanks!

๐Ÿ‘ 1