mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-25 14:08:31 +00:00
Fix "ex" variable collision in invidious.cr
The exception handling for database connections results in an `ex` variable which Ameba sees as overshadowing the `ex` used by the `ex` block arg used to define the HTTP status code 500 handler below. Although this is a non-issue since the db connection exception handling will cause Invidious to exit, Ameba's nature as a static checker means that it isn't aware of this. The simplest fix without a dirty ameba ignore comment is to rename `ex` within the Kemal handler block below, since `ex` within a begin rescue block is a Crystal convention that will also cause Ameba to raise when not adhered to.
This commit is contained in:
parent
8723fdca06
commit
67f93e55d8
@ -62,8 +62,8 @@ HMAC_KEY = CONFIG.hmac_key
|
|||||||
|
|
||||||
PG_DB = begin
|
PG_DB = begin
|
||||||
DB.open CONFIG.database_url
|
DB.open CONFIG.database_url
|
||||||
rescue exc
|
rescue ex
|
||||||
puts "Failed to connect to PostgreSQL database: #{exc.cause.try &.message}"
|
puts "Failed to connect to PostgreSQL database: #{ex.cause.try &.message}"
|
||||||
puts "Check your 'config.yml' database settings or PostgreSQL settings."
|
puts "Check your 'config.yml' database settings or PostgreSQL settings."
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
@ -227,8 +227,8 @@ error 404 do |env|
|
|||||||
Invidious::Routes::ErrorRoutes.error_404(env)
|
Invidious::Routes::ErrorRoutes.error_404(env)
|
||||||
end
|
end
|
||||||
|
|
||||||
error 500 do |env, ex|
|
error 500 do |env, exception|
|
||||||
error_template(500, ex)
|
error_template(500, exception)
|
||||||
end
|
end
|
||||||
|
|
||||||
static_headers do |env|
|
static_headers do |env|
|
||||||
|
Loading…
Reference in New Issue
Block a user