Add BetterErrors gem.

This commit is contained in:
evazion
2021-01-30 14:19:37 -06:00
parent c0f27d6e3b
commit 896e5cb763
4 changed files with 15 additions and 1 deletions

View File

@@ -65,6 +65,8 @@ group :development do
gem 'stackprof'
gem 'flamegraph'
gem 'memory_profiler'
gem 'better_errors'
gem 'binding_of_caller'
end
group :development, :test do

View File

@@ -115,6 +115,12 @@ GEM
aws-sigv4 (1.2.2)
aws-eventstream (~> 1, >= 1.0.2)
bcrypt (3.1.16)
better_errors (2.9.1)
coderay (>= 1.0.0)
erubi (>= 1.0.0)
rack (>= 0.9.0)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
bootsnap (1.5.1)
msgpack (~> 1.0)
builder (3.2.4)
@@ -153,6 +159,7 @@ GEM
crass (1.0.6)
daemons (1.3.1)
dante (0.2.0)
debug_inspector (1.0.0)
delayed_job (4.1.9)
activesupport (>= 3.0, < 6.2)
delayed_job_active_record (4.1.5)
@@ -415,6 +422,8 @@ DEPENDENCIES
addressable
aws-sdk-sqs (~> 1)
bcrypt
better_errors
binding_of_caller
bootsnap
builder
capistrano (~> 3.10)

View File

@@ -120,7 +120,7 @@ class ApplicationController < ActionController::Base
when PG::ConnectionBad
render_error_page(503, exception, message: "The database is unavailable. Try again later.")
else
raise exception if Danbooru.config.debug_mode
raise exception if !Rails.env.production? || Danbooru.config.debug_mode
render_error_page(500, exception)
end
end

View File

@@ -63,4 +63,7 @@ Rails.application.configure do
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
BetterErrors::Middleware.allow_ip!(IPAddr.new("0.0.0.0/0"))
BetterErrors::Middleware.allow_ip!(IPAddr.new("::/0"))
end