8000 Show message when connection to the database is not possible by Fijxu · Pull Request #5346 · iv-org/invidious · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Show message when connection to the database is not possible #5346

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Fijxu
Copy link
Member
@Fijxu Fijxu commented Jun 12, 2025

This gives a better message when something goes wrong on the database connection. May not be better for debugging purposes, but the error messages returned are from PostgreSQL and they are very self explanatory (I believe)

image

@syeopite syeopite added the ready label Jun 15, 2025
src/invidious.cr Outdated
Comment on lines 65 to 66
rescue ex
puts "Failed to connect to PostgreSQL database: #{ex.cause.try &.message}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make the linter happy:

Suggested change
rescue ex
puts "Failed to connect to PostgreSQL database: #{ex.cause.try &.message}"
rescue exc
puts "Failed to connect to PostgreSQL database: #{exc.cause.try &.message}"

Copy link
Member
@SamantazFox SamantazFox Jun 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vdfjvgbdkrfg
I should have checked the ameba docs, sorry :/

src/invidious.cr:65:1
[C] Naming/RescuedExceptionsVariableName: Disallowed variable name, use one of these instead: 'e', 'ex', 'exception', 'error'
> rescue exc
  ^

Co-authored-by: Samantaz Fox <coding@samantaz.fr>
Comment on lines +65 to +66
rescue exc
puts "Failed to connect to PostgreSQL database: #{exc.cause.try &.message}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rescue exc
puts "Failed to connect to PostgreSQL database: #{exc.cause.try &.message}"
rescue e
puts "Failed to connect to PostgreSQL database: #{e.cause.try &.message}"

Copy link
Member Author
@Fijxu Fijxu Jun 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change all rescue ex from the source code to make the linter happy or just this part :?

ex seems to be accepted 🤔

Copy link
Member
@syeopite syeopite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I didn't realize that lint also failed... It would be nice if the Github UI could indicate failures of unstable branches vs stable ones like the lint job.

Anyways the original error was because the ex variable ended up overshadowing the variable in this Kemal status code handler later on:

error 500 do |env, ex|

The fix is to change that ex to something else rather than change the variable for the rescue block.

@syeopite syeopite removed the ready label Jun 21, 2025
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

Successfully merging this pull request may close these issues.

4 participants
0