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 +4 -4
 - data/lib/errorkit.rb +3 -3
 - data/lib/errorkit/config.rb +2 -0
 - data/lib/errorkit/version.rb +1 -1
 - data/lib/generators/errorkit/templates/app/views/errors/error_notification.html.erb +28 -14
 - data/lib/generators/errorkit/templates/config/initializers/errorkit.rb +7 -0
 - data/lib/generators/errorkit/templates/db/migrate/create_errors.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b190fe4611fdf5f105f9923ed6176001e00f9adb
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8d664bfaf80e33520c969638c151516da2d0bd88
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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
         
     | 
    
        data/lib/errorkit/config.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         | 
    
        data/lib/errorkit/version.rb
    CHANGED
    
    
| 
         @@ -1,27 +1,39 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            An <strong><%= error.exception %></strong>  
     | 
| 
      
 1 
     | 
    
         
            +
            <h2 style="color:red">An <strong><%= error.exception %></strong> occurred in <%= error.environment %> (error: <%= error.to_param %>):</h2>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <hr>
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            < 
     | 
| 
      
 4 
     | 
    
         
            +
            <blockquote style="font-size: 1.5em">
         
     | 
| 
       4 
5 
     | 
    
         
             
            <%= error.message %>
         
     | 
| 
       5 
     | 
    
         
            -
            </ 
     | 
| 
      
 6 
     | 
    
         
            +
            </blockquote>
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            < 
     | 
| 
       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 
     | 
    
         
            -
            < 
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
            < 
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
            < 
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            <%= error.payload %>
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
            < 
     | 
| 
      
 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 
     | 
    
         
             
              #
         
     |