errdo 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/errdo/exception.rb +14 -2
- data/lib/errdo/version.rb +1 -1
- data/lib/errdo.rb +3 -0
- data/lib/generators/templates/errdo.rb +7 -2
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +38 -0
- data/test/dummy/log/test.log +44421 -0
- data/test/dummy/tmp/pids/server.pid +1 -1
- data/test/integrations/errors_integration_test.rb +11 -0
- data/test/test_helper.rb +8 -0
- data/test/tmp/config/initializers/errdo.rb +7 -51
- metadata +2 -4
- data/test/tmp/config/application.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d31dc6f2561711decdfed508abfa52d7861ce150
|
4
|
+
data.tar.gz: 6f83b1ae3edcec3a80f31ab10706ddd330378634
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b8ca017cbfc3c3907dccb1971b2025e5ac4e185afb2fd0287a5bb5aee0c54aac1ed78b4f80588e315867526f5be590f131e2652f612187ddd6cf87ba55ff188
|
7
|
+
data.tar.gz: e77f579acbb26c895ac7973fb4256a4c75bd4c300fd24dec8de9543519f3d7c02df115e00874ee89e969ee5ee5e396df5701d8b1cb0b8feb46b4ed97b82ab0c2
|
@@ -7,8 +7,10 @@ module Errdo
|
|
7
7
|
|
8
8
|
error = nil
|
9
9
|
error = create_errors(@env_parser) unless Errdo.error_name.blank?
|
10
|
-
|
11
|
-
|
10
|
+
unless too_soon? error
|
11
|
+
Errdo.notify_with.each do |notifier|
|
12
|
+
notifier.notify(@env_parser, error: error)
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -20,5 +22,15 @@ module Errdo
|
|
20
22
|
return error
|
21
23
|
end
|
22
24
|
|
25
|
+
def too_soon?(error)
|
26
|
+
return false if error.nil?
|
27
|
+
|
28
|
+
last_occurrence = error.error_occurrences.offset(1).order("created_at asc").last
|
29
|
+
if last_occurrence && Errdo.ignore_time && last_occurrence.created_at > (Time.current - Errdo.ignore_time)
|
30
|
+
return true
|
31
|
+
end
|
32
|
+
return false
|
33
|
+
end
|
34
|
+
|
23
35
|
end
|
24
36
|
end
|
data/lib/errdo/version.rb
CHANGED
data/lib/errdo.rb
CHANGED
@@ -7,6 +7,11 @@ Errdo.setup do |config|
|
|
7
7
|
# By default, 404 errors are ignored. To un-ignore them, set this to true
|
8
8
|
# config.log404 = true
|
9
9
|
|
10
|
+
# By default, errors are ignored (for notification only) if they happen
|
11
|
+
# within 5 minutes of the last identical error.
|
12
|
+
# This can be changed by setting
|
13
|
+
# config.ignore_time = 5.minutes
|
14
|
+
|
10
15
|
## == Authorization and Devise integration =========
|
11
16
|
# If you have the ability to track who's logged in, setting the current_user_method
|
12
17
|
# will allow the logged-in user to be recorded with the error
|
@@ -44,7 +49,7 @@ Errdo.setup do |config|
|
|
44
49
|
# If you want to set up slack, this is the only required parameter.
|
45
50
|
# The rest are totally optional, and default to the values here
|
46
51
|
#
|
47
|
-
#
|
52
|
+
# config.notify_with slack: { webhook: "WEBHOOK-URL",
|
48
53
|
# channel: nil
|
49
54
|
# icon: ":boom:",
|
50
55
|
# name: "Errdo-bot" }
|
@@ -52,5 +57,5 @@ Errdo.setup do |config|
|
|
52
57
|
|
53
58
|
## == Non Web Requests ============================
|
54
59
|
# Error logging for rake tasks is on by default. To turn it off, set
|
55
|
-
#
|
60
|
+
# config.log_task_exceptions = false
|
56
61
|
end
|
Binary file
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -49685,3 +49685,41 @@ X-Content-Type-Options: nosniff
|
|
49685
49685
|
FROM sqlite_temp_master
|
49686
49686
|
WHERE name='index_users_on_email' AND type='index'
|
49687
49687
|
[0m
|
49688
|
+
|
49689
|
+
|
49690
|
+
Started GET "/" for 127.0.0.1 at 2016-11-20 16:15:38 -0500
|
49691
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
49692
|
+
Processing by StaticController#home as HTML
|
49693
|
+
Rendered static/home.html.erb (0.3ms)
|
49694
|
+
Completed 200 OK in 6ms (Views: 5.7ms | ActiveRecord: 0.0ms)
|
49695
|
+
|
49696
|
+
|
49697
|
+
Started GET "/static/generic_error" for 127.0.0.1 at 2016-12-01 19:18:45 -0500
|
49698
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
49699
|
+
Processing by StaticController#generic_error as HTML
|
49700
|
+
Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
|
49701
|
+
|
49702
|
+
RuntimeError (standard-error):
|
49703
|
+
app/controllers/static_controller.rb:7:in `generic_error'
|
49704
|
+
|
49705
|
+
|
49706
|
+
[1m[35mErrdo::Error Load (0.9ms)[0m SELECT "errors".* FROM "errors" WHERE "errors"."backtrace_hash" = ? LIMIT 1 [["backtrace_hash", "trollers/static_controller.rb:7:in `generic_error'standard-errorRuntimeError"]]
|
49707
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
49708
|
+
[1m[35mSQL (0.6ms)[0m INSERT INTO "error_occurrences" ("ip", "user_agent", "query_string", "param_values", "cookie_values", "header_values", "error_id", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["ip", "127.0.0.1"], ["user_agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.100 Safari/537.36"], ["query_string", ""], ["param_values", "--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontroller: static\naction: generic_error\n"], ["cookie_values", "---\nremember_user_token: W1sxXSwiJDJhJDEwJC9DbmZGRzNSQVd4VnlsWVNLdFJtVGUiLCIxNDc5NTkyMzk1LjM0MTExNjciXQ==--8a6748f30e89e765bea9d3050937b6ec2e7b7f89\n_ga: GA1.1.2096945490.1464561447\n"], ["header_values", "---\nX-Frame-Options: SAMEORIGIN\nX-XSS-Protection: 1; mode=block\nX-Content-Type-Options: nosniff\n"], ["error_id", 5], ["created_at", "2016-12-02 00:18:45.932184"], ["updated_at", "2016-12-02 00:18:45.932184"]]
|
49709
|
+
[1m[36mSQL (0.3ms)[0m [1mUPDATE "errors" SET "occurrence_count" = COALESCE("occurrence_count", 0) + 1 WHERE "errors"."id" = ?[0m [["id", 5]]
|
49710
|
+
[1m[35mErrdo::Error Exists (0.5ms)[0m SELECT 1 AS one FROM "errors" WHERE ("errors"."backtrace_hash" = 'trollers/static_controller.rb:7:in `generic_error''standard-errorRuntimeError' AND "errors"."id" != 5) LIMIT 1
|
49711
|
+
[1m[36mSQL (0.7ms)[0m [1mUPDATE "errors" SET "occurrence_count" = ?, "last_occurred_at" = ?, "updated_at" = ? WHERE "errors"."id" = ?[0m [["occurrence_count", 69], ["last_occurred_at", "2016-12-02 00:18:45.932184"], ["updated_at", "2016-12-02 00:18:45.962370"], ["id", 5]]
|
49712
|
+
[1m[35mErrdo::Error Exists (0.2ms)[0m SELECT 1 AS one FROM "errors" WHERE ("errors"."backtrace_hash" = 'trollers/static_controller.rb:7:in `generic_error''standard-errorRuntimeError' AND "errors"."id" != 5) LIMIT 1
|
49713
|
+
[1m[36mSQL (2.3ms)[0m [1mUPDATE "errors" SET "last_experiencer_id" = ?, "last_experiencer_type" = ?, "updated_at" = ? WHERE "errors"."id" = ?[0m [["last_experiencer_id", nil], ["last_experiencer_type", nil], ["updated_at", "2016-12-02 00:18:45.984969"], ["id", 5]]
|
49714
|
+
[1m[35m (6.5ms)[0m commit transaction
|
49715
|
+
[1m[36mErrdo::ErrorOccurrence Load (0.4ms)[0m [1mSELECT "error_occurrences".* FROM "error_occurrences" ORDER BY "error_occurrences"."id" DESC LIMIT 1[0m
|
49716
|
+
[1m[35mErrdo::ErrorOccurrence Load (0.7ms)[0m SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY "error_occurrences"."id" DESC LIMIT 1 OFFSET 1
|
49717
|
+
[1m[36mErrdo::ErrorOccurrence Load (4.9ms)[0m [1mSELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1 OFFSET 1[0m
|
49718
|
+
[1m[35mErrdo::ErrorOccurrence Load (1.7ms)[0m SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1 OFFSET 2
|
49719
|
+
[1m[36mErrdo::ErrorOccurrence Load (2.3ms)[0m [1mSELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1[0m
|
49720
|
+
[1m[35mErrdo::ErrorOccurrence Load (4.1ms)[0m SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1 OFFSET 100
|
49721
|
+
[1m[36mErrdo::ErrorOccurrence Load (1.7ms)[0m [1mSELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1 OFFSET 1[0m
|
49722
|
+
[1m[35mErrdo::ErrorOccurrence Load (1.0ms)[0m SELECT "error_occurrences".* FROM "error_occurrences" WHERE "error_occurrences"."error_id" = ? ORDER BY "error_occurrences"."id" DESC LIMIT 1 OFFSET 1 [["error_id", 5]]
|
49723
|
+
[1m[36mErrdo::ErrorOccurrence Load (1.0ms)[0m [1mSELECT "error_occurrences".* FROM "error_occurrences" WHERE "error_occurrences"."error_id" = ? ORDER BY created_at DESC LIMIT 1 OFFSET 1[0m [["error_id", 5]]
|
49724
|
+
[1m[35mErrdo::ErrorOccurrence Load (1.7ms)[0m SELECT "error_occurrences".* FROM "error_occurrences" WHERE "error_occurrences"."error_id" = ? ORDER BY created_at DESC LIMIT 1 OFFSET 0 [["error_id", 5]]
|
49725
|
+
[1m[36mErrdo::ErrorOccurrence Load (0.5ms)[0m [1mSELECT "error_occurrences".* FROM "error_occurrences" ORDER BY "error_occurrences"."id" DESC LIMIT 1[0m
|