errorkit 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2b7253a2149514a9a632edbc520aa150a8197a8
4
- data.tar.gz: cd87a967fea8dc4b8bc0455a40f33f72719fb941
3
+ metadata.gz: b190fe4611fdf5f105f9923ed6176001e00f9adb
4
+ data.tar.gz: 8d664bfaf80e33520c969638c151516da2d0bd88
5
5
  SHA512:
6
- metadata.gz: 4c644359b347b965202530afd86c47886edb376d56545bc8e06eae50da6b1ffa5a9abe1bad9ec122173cfb00dc85a90d26b26e177bfc6bd75242460ae5b897ae
7
- data.tar.gz: 1cb701c40ff18992e83abd1435995cd080ff99686da3ab734df970e7eb6ef576006b37428530f106657e38f31b36d1ccb9285c0f74d153f780d0934b2b5e2191
6
+ metadata.gz: 30b7a34f7d8a4c678c4cfeb8ed982a406af334b1388aec1f24135a39d3dc160224cb5e38bdc5d8b2eb3d5d26622553eddccfc57bb382d33a8756fb2d1a8aa1ea
7
+ data.tar.gz: 792308d6d3794e331c2d75da1086085424ad52f9c622e3c9d3566996d012aefbe7f5d74ad1f6e3c1147e5c0f519a61914bde7191cce8babf9d0768fbb2bf87d2
data/lib/errorkit.rb CHANGED
@@ -59,9 +59,9 @@ module Errorkit
59
59
  exception: exception.class.to_s,
60
60
  message: exception.message,
61
61
  backtrace: clean_backtrace(exception),
62
- worker: worker,
63
- queue: queue,
64
- payload: payload
62
+ worker: worker.class.to_s,
63
+ queue: queue.to_s,
64
+ payload: payload.to_json
65
65
  )
66
66
  send_notification(error)
67
67
  error
@@ -11,6 +11,7 @@ module Errorkit
11
11
  :mailer_sender,
12
12
  :max_notifications_per_minute,
13
13
  :max_notifications_per_quarter_hour,
14
+ :format_errors,
14
15
  :alert_threshold
15
16
 
16
17
 
@@ -25,6 +26,7 @@ module Errorkit
25
26
  @ignore_agents = %w{Googlebot MSNBot Baiduspider Bing Inktomi Yahoo AskJeeves FastCrawler InfoSeek Lycos YandexBot NewRelicPinger Pingdom}
26
27
  @max_notifications_per_minute = 5
27
28
  @max_notifications_per_quarter_hour = 10
29
+ @format_errors = true
28
30
  @alert_threshold = 0.4
29
31
  end
30
32
 
@@ -1,3 +1,3 @@
1
1
  module Errorkit
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,27 +1,39 @@
1
- An <strong><%= error.exception %></strong> error occurred in <%= error.environment %> (error: <%= error.to_param %>):
1
+ <h2 style="color:red">An <strong><%= error.exception %></strong> occurred in <%= error.environment %> (error: <%= error.to_param %>):</h2>
2
+ <hr>
2
3
 
3
- <p>
4
+ <blockquote style="font-size: 1.5em">
4
5
  <%= error.message %>
5
- </p>
6
+ </blockquote>
6
7
 
7
- <h5>Backtrace</h5>
8
- <pre><%= error.backtrace %></pre>
8
+ <h3>Backtrace</h3>
9
+ <pre style="white-space:pre-wrap"><%= error.backtrace %></pre>
9
10
 
10
11
  <% if error.controller %>
11
- <h5>Session</h5>
12
- <pre><%= error.params %></pre>
12
+ <h3>Session</h3>
13
+ <% if Errorkit.config.format_errors && defined?(ap) %>
14
+ <%= ap(JSON.parse(error.session), indent: 2).html_safe rescue error.session %>
15
+ <% else %>
16
+ <pre style="white-space:pre-wrap"><%= error.session %></pre>
17
+ <% end %>
13
18
 
14
- <h5>Params</h5>
15
- <pre><%= error.session %></pre>
19
+ <h3>Params</h3>
20
+ <% if Errorkit.config.format_errors && defined?(ap) %>
21
+ <%= ap(JSON.parse(error.params), indent: 2).html_safe rescue error.params %>
22
+ <% else %>
23
+ <pre style="white-space:pre-wrap"><%= error.params %></pre>
24
+ <% end %>
16
25
  <% end %>
17
26
 
18
27
  <% if error.worker %>
19
- <h5>Payload</h5>
20
- <pre>
21
- <%= error.payload %>
22
- </pre>
28
+ <h3>Payload</h3>
29
+ <% if Errorkit.config.format_errors && defined?(ap) %>
30
+ <%= ap(JSON.parse(error.payload), indent: 2).html_safe rescue error.payload %>
31
+ <% else %>
32
+ <pre style="white-space:pre-wrap"><%= error.payload %></pre>
33
+ <% end %>
34
+ <% end %>
23
35
 
24
- <h5>Details</h5>
36
+ <h3>Details</h3>
25
37
  <ul>
26
38
  <li>Environment: <%= error.environment %></li>
27
39
  <li>Server: <%= error.server %></li>
@@ -36,3 +48,5 @@ An <strong><%= error.exception %></strong> error occurred in <%= error.environme
36
48
  <li>Queue: <%= error.queue %></li>
37
49
  <% end %>
38
50
  </ul>
51
+
52
+
@@ -75,6 +75,13 @@ Errorkit.configure do
75
75
  # To turn off throttling set these values to nil
76
76
 
77
77
 
78
+ # You may want to turn off formatting in the emails (it is only on if you
79
+ # have the awesome_print gem installed):
80
+ #
81
+ # config.format_errors = true
82
+ #
83
+ # To turn off formatting set this to false
84
+
78
85
  # It is possible to create alerts that occur only when the number of
79
86
  # errors per request exceeds a specific percentage.
80
87
  #
@@ -17,7 +17,7 @@ class CreateErrors < ActiveRecord::Migration
17
17
  t.text :params
18
18
  t.string :worker
19
19
  t.string :queue
20
- t.string :payload
20
+ t.text :payload
21
21
  t.text :url
22
22
  t.integer :user_id
23
23
  t.integer :subject_id
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errorkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Rafter