boot-clj / boot-cljs

Boot task to compile ClojureScript programs.
Eclipse Public License 1.0
176 stars 40 forks source link

Handle clojure.spec exceptions #181

Closed burn2delete closed 6 years ago

burn2delete commented 6 years ago

Clojure.spec cannot be serialized, this PR will catch the NotSerializableException and throw the original exception early. Update: See last comment.

burn2delete commented 6 years ago

This PR will show errors related to #177

burn2delete commented 6 years ago

I have improved this PR.

@Deraen now makes 3 changes:

  1. Check for clojure.spec.alpha/spec and clojure.spec/spec in data and remove from exception. (Clojure specs cannot be serialized.)
  2. Remove the original exception from ex-info, ie. do not provide 3rd argument as it still contains the specs.
  3. Include a catch for any other serialization related issues and re-throw the original exception.
Deraen commented 6 years ago

Thanks, I'll have to think about this. Including spec data would probably be useful, if possible somehow.

Rethrowing original exception if it can't be serialized is probably good idea.

burn2delete commented 6 years ago

@Deraen is there a reason we serialize at all? It looks like we just do it to return the map which throws anyway. Seems we could skip the serialization and throw after handle-ex?