framed-data / overseer

Overseer is a library for building and running data pipelines in Clojure.
Eclipse Public License 1.0
97 stars 10 forks source link

Use `throw` instead of `assert` in store.jdbc updates #99

Closed andrewberls closed 6 years ago

andrewberls commented 6 years ago

Previously, 3 protocol functions in overseer.store.jdbc used assert to check the success of a row update (finish-job, fail-job, heartbeat-job). However java.lang.AssertionError does not inherit from Exception and was thus missed in the rescue codepath, causing app crashes instead of going through error-logging paths. Furthermore if one does not monitor or redirect stderr it can be extremely difficult to detect the source of these "silent crashes".

This changes the named functions to use throw (ex-info ...) instead of assert, which should be reserved for "impossible" system invariants, and the failed-update behavior is now unit-tested.