mmetro / WeirdSideofYouTube

MIT License
6 stars 3 forks source link

Server crashes when database is empty #54

Open colatkinson opened 7 years ago

colatkinson commented 7 years ago

When installing in a fresh environment, there is an unhandled problem when querying Counter finds no results. This results in randomVideoID attempting to access the seq property of null, causing a fatal exception.

I'd suggest several steps to handle this:

  1. Handling this case on the server gracefully and returning an appropriate error
  2. Handling this case on the client, and show an interface stating that no videos were found
  3. Creating a script to add videos to the database for developers deploying the site
colatkinson commented 7 years ago

Fixed short term in #62. We still need to actually handle the error gracefully, however. We probably need a UI element on the client side to just say "no videos found" when the server returns that condition. The server should just return an error JSON when null is returned from a db query.

ghost commented 7 years ago

Somewhat related: Fixed error where server would also crash when database has only one video