Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing migrations directory throws unhelpful NPE #41

Open
jpolchlo opened this issue Aug 14, 2024 · 0 comments
Open

Missing migrations directory throws unhelpful NPE #41

jpolchlo opened this issue Aug 14, 2024 · 0 comments

Comments

@jpolchlo
Copy link

While working on another project, I ended up spending a long time chasing down a NullPointerException inside Drift. I found the culprit being that the configured migrations directory (as indicated by the :directory key in the config map) was missing. As a new user, the NPE was unhelpful, since I had inherited my code, which I had presumed ran correctly in the past. The NPE didn't provide useful breadcrumbs.

The location in question in Drift that raised the unhelpful NPE is here:

drift/src/drift/core.clj

Lines 114 to 119 in 1acfe11

(defn default-migration-namespaces []
(->> (find-migrate-directory)
.listFiles
(map #(.getName ^File %))
(filter #(re-matches #".*\.clj$" %))
(map namespace-string-for-file)))

I'd imagine that a null check that throws a useful missing directory error might help someone else in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant