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

Fail-fast missing dependency detection #4

Open
nic-hartley opened this issue Oct 9, 2018 · 0 comments
Open

Fail-fast missing dependency detection #4

nic-hartley opened this issue Oct 9, 2018 · 0 comments
Labels
feature Something should be added up for grabs Anyone is free to take this and implement it

Comments

@nic-hartley
Copy link
Member

nic-hartley commented Oct 9, 2018

Goal

This will make starting up the server much easier, as it'll automatically detect when something is wrong and give steps to fix it.

Description

Proactively examine the application.properties file and test the connection to both the database and the object store before Spring would throw errors, and let the user know in a more readable way what went wrong and how to fix it. We can also point them to the appropriate section in the README. Either way, it's better than what we have now. For example, if we can't establish a connection to the database, we might output:

Could not connect to the SQL database. Make sure you've specified the correct URL, username, and password in application.properties, and that the server is currently running.

If we're missing the application.properties file entirely, we currently throw an obtuse error about not being able to pick the right database driver (because it's derived from the URL, which isn't specified). With this implemented, we could show something like:

No application.properties file found. You must provide one.

We need to make sure this stays compatible with other Spring-compatible config, though, so we need to find some way to insert an init step after Spring has read the config but before any automated DB/whatever setup occurs.

Alternatives

  • Leaving the standard exceptions from Spring -- these are fine for developers with Spring experience who know what the errors mean and how to fix them. They're not so fine for end users trying to set up the backend without realizing they're missing something.
  • Trapping errors thrown by Spring on startup -- this seems to be, if not impossible, at least very difficult to do well; as far as I can tell we'd end up trapping database errors during the server's normal operation as well, which may cause issues.
@nic-hartley nic-hartley added the feature Something should be added label Oct 9, 2018
@nic-hartley nic-hartley added this to the 1.0 milestone Oct 11, 2018
@nic-hartley nic-hartley added the up for grabs Anyone is free to take this and implement it label Oct 17, 2018
@nic-hartley nic-hartley modified the milestones: Open Source, Public Production Nov 5, 2018
@nic-hartley nic-hartley removed this from the Public Production milestone Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Something should be added up for grabs Anyone is free to take this and implement it
Projects
None yet
Development

No branches or pull requests

1 participant