exception_hunter 0.1.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +35 -7
- data/app/assets/stylesheets/exception_hunter/base.css +62 -8
- data/app/assets/stylesheets/exception_hunter/errors.css +166 -24
- data/app/assets/stylesheets/exception_hunter/navigation.css +20 -5
- data/app/assets/stylesheets/exception_hunter/sessions.css +71 -0
- data/app/controllers/concerns/exception_hunter/authorization.rb +23 -0
- data/app/controllers/exception_hunter/application_controller.rb +2 -0
- data/app/controllers/exception_hunter/errors_controller.rb +27 -4
- data/app/controllers/exception_hunter/resolved_errors_controller.rb +11 -0
- data/app/helpers/exception_hunter/errors_helper.rb +7 -0
- data/app/helpers/exception_hunter/sessions_helper.rb +16 -0
- data/app/models/exception_hunter/application_record.rb +8 -0
- data/app/models/exception_hunter/error.rb +21 -8
- data/app/models/exception_hunter/error_group.rb +24 -5
- data/app/presenters/exception_hunter/dashboard_presenter.rb +54 -0
- data/app/presenters/exception_hunter/error_group_presenter.rb +25 -0
- data/app/presenters/exception_hunter/error_presenter.rb +10 -1
- data/app/views/exception_hunter/devise/sessions/new.html.erb +24 -0
- data/app/views/exception_hunter/errors/_error_row.erb +44 -0
- data/app/views/exception_hunter/errors/_error_summary.erb +23 -10
- data/app/views/exception_hunter/errors/_error_user_data.erb +4 -5
- data/app/views/exception_hunter/errors/_errors_table.erb +1 -0
- data/app/views/exception_hunter/errors/_last_7_days_errors_table.erb +12 -0
- data/app/views/exception_hunter/errors/index.html.erb +71 -30
- data/app/views/exception_hunter/errors/pagy/_pagy_nav.html.erb +15 -15
- data/app/views/exception_hunter/errors/show.html.erb +58 -22
- data/app/views/layouts/exception_hunter/application.html.erb +65 -6
- data/app/views/layouts/exception_hunter/exception_hunter_logged_out.html.erb +24 -0
- data/config/rails_best_practices.yml +2 -3
- data/config/routes.rb +19 -1
- data/lib/exception_hunter.rb +12 -2
- data/lib/exception_hunter/config.rb +8 -1
- data/lib/exception_hunter/devise.rb +17 -0
- data/lib/exception_hunter/engine.rb +5 -0
- data/{app/services → lib}/exception_hunter/error_creator.rb +17 -5
- data/lib/exception_hunter/error_reaper.rb +12 -0
- data/lib/exception_hunter/middleware/delayed_job_hunter.rb +69 -0
- data/lib/exception_hunter/middleware/request_hunter.rb +71 -0
- data/lib/exception_hunter/middleware/sidekiq_hunter.rb +59 -0
- data/lib/exception_hunter/tracking.rb +17 -0
- data/lib/exception_hunter/user_attributes_collector.rb +4 -0
- data/lib/exception_hunter/version.rb +1 -1
- data/lib/generators/exception_hunter/create_users/create_users_generator.rb +8 -1
- data/lib/generators/exception_hunter/install/install_generator.rb +3 -1
- data/lib/generators/exception_hunter/install/templates/create_exception_hunter_error_groups.rb.erb +3 -0
- data/lib/generators/exception_hunter/install/templates/exception_hunter.rb.erb +23 -0
- data/lib/tasks/exception_hunter_tasks.rake +6 -4
- metadata +25 -10
- data/config/initializers/exception_hunter.rb +0 -16
- data/lib/exception_hunter/railtie.rb +0 -11
- data/lib/exception_hunter/request_hunter.rb +0 -41
@@ -1,16 +0,0 @@
|
|
1
|
-
ExceptionHunter.setup do |config|
|
2
|
-
# == Current User
|
3
|
-
#
|
4
|
-
# Exception Hunter will include the user as part of the environment
|
5
|
-
# data, if it was to be available. The default configuration uses devise
|
6
|
-
# :current_user method. You can change it in case
|
7
|
-
#
|
8
|
-
config.current_user_method = :current_user
|
9
|
-
|
10
|
-
# == Current User Attributes
|
11
|
-
#
|
12
|
-
# Exception Hunter will try to include the attributes defined here
|
13
|
-
# as part of the user information that is kept from the request.
|
14
|
-
#
|
15
|
-
config.user_attributes = [:id, :email]
|
16
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require_dependency 'exception_hunter/request_hunter'
|
2
|
-
|
3
|
-
module ExceptionHunter
|
4
|
-
class Railtie < Rails::Railtie
|
5
|
-
initializer 'exception_hunter.add_middleware', after: :load_config_initializers do |app|
|
6
|
-
app.config.middleware.insert_after(
|
7
|
-
ActionDispatch::DebugExceptions, ExceptionHunter::RequestHunter
|
8
|
-
)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module ExceptionHunter
|
2
|
-
class RequestHunter
|
3
|
-
ENVIRONMENT_KEYS =
|
4
|
-
%w[PATH_INFO QUERY_STRING REMOTE_HOST REQUEST_METHOD REQUEST_URI
|
5
|
-
SERVER_PROTOCOL HTTP_HOST HTTP_USER_AGENT].freeze
|
6
|
-
|
7
|
-
def initialize(app)
|
8
|
-
@app = app
|
9
|
-
end
|
10
|
-
|
11
|
-
def call(env)
|
12
|
-
@app.call(env)
|
13
|
-
rescue Exception => exception
|
14
|
-
catch_prey(env, exception)
|
15
|
-
raise exception
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def catch_prey(env, exception)
|
21
|
-
user = user_from_env(env)
|
22
|
-
ErrorCreator.call(
|
23
|
-
class_name: exception.class.to_s,
|
24
|
-
message: exception.message,
|
25
|
-
environment_data: environment_data(env),
|
26
|
-
backtrace: exception.backtrace,
|
27
|
-
user: user
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
def environment_data(env)
|
32
|
-
env.select { |key, _value| ENVIRONMENT_KEYS.include?(key) }
|
33
|
-
end
|
34
|
-
|
35
|
-
def user_from_env(env)
|
36
|
-
current_user_method = Config.current_user_method
|
37
|
-
controller = env['action_controller.instance']
|
38
|
-
controller.try(current_user_method)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|