exception_engine 0.3.0 → 0.3.1

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.
@@ -0,0 +1,7 @@
1
+ class ExceptionsController < ApplicationController
2
+ before_filter :exception_engine_authentication
3
+
4
+ def index
5
+ @exceptions = ExceptionEngine::Data.all.descending(:created_at)
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module ExceptionEngine
2
+ class BacktraceData
3
+ include Mongoid::Document
4
+
5
+ field :number
6
+ field :file
7
+ field :ruby_method
8
+ embedded_in :data, :inverse_of => :backtraces
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ module ExceptionEngine
2
+ class Data
3
+ include Mongoid::Document
4
+
5
+ field :error_class
6
+ field :error_message
7
+ embeds_many :backtraces, :class_name => "ExceptionEngine::BacktraceData"
8
+ field :created_at, :type => Time
9
+
10
+ def self.store!(args)
11
+ data = new
12
+ data.parse(args)
13
+ data.save!
14
+ end
15
+
16
+ def parse(notice)
17
+ self.error_class = notice.error_class
18
+ self.error_message = notice.error_message
19
+ notice.backtrace.lines.each do | line |
20
+ self.backtraces << ExceptionEngine::BacktraceData.new(:number => line.number, :file => line.file, :ruby_method => line.method) if !line.nil?
21
+ end
22
+ self.created_at = Time.now.utc
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,30 @@
1
+ <h2>List of Exceptions</h2>
2
+
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th>Date</th>
7
+ <th>Error Message</th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ <% @exceptions.each do |e| %>
12
+ <tr>
13
+ <td valign="top"><p><%= e.created_at.strftime("%d/%m/%Y %H:%M %p") if !e.created_at.nil? %></p></td>
14
+ <td>
15
+ <p><%= e.error_message %></p>
16
+
17
+ <p>Backtrace:</p>
18
+ <div id='backtrace'>
19
+ <% if !e.backtraces.empty? %>
20
+ <% e.backtraces.each do |b| %>
21
+ <%= b.number%> - <%= b.file %> - <%= b.ruby_method %><br />
22
+ <% end %>
23
+ <% end %>
24
+ </div>
25
+ </td>
26
+ </tr>
27
+ <% end %>
28
+ </tbody>
29
+ </table>
30
+
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ resources :exceptions, :only => [:index, :destroy]
3
+ end
@@ -1,3 +1,3 @@
1
1
  module ExceptionEngine
2
- VERSION = "0.3.0".freeze
2
+ VERSION = "0.3.1".freeze
3
3
  end
@@ -582,3 +582,31 @@ Started GET "/exceptions" for 127.0.0.1 at 2011-02-10 12:43:54 +0800
582
582
  Processing by ExceptionsController#index as HTML
583
583
  Rendered /Users/fadhlirahim/Projects/exception_engine/app/views/exceptions/index.html.erb within layouts/application (89.5ms)
584
584
  Completed 200 OK in 127ms (Views: 98.0ms | ActiveRecord: 0.0ms)
585
+
586
+
587
+ Started GET "/exceptions" for 127.0.0.1 at 2011-02-10 13:20:46 +0800
588
+ Processing by ExceptionsController#index as HTML
589
+ Rendered /Users/fadhlirahim/Projects/exception_engine/app/views/exceptions/index.html.erb within layouts/application (90.0ms)
590
+ Completed 200 OK in 127ms (Views: 98.3ms | ActiveRecord: 0.0ms)
591
+
592
+
593
+ Started GET "/" for 127.0.0.1 at 2011-02-10 15:18:09 +0800
594
+
595
+ ActionController::RoutingError (No route matches "/"):
596
+
597
+
598
+ Rendered /Users/fadhlirahim/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (6.2ms)
599
+
600
+
601
+ Started GET "/" for 127.0.0.1 at 2011-02-17 17:26:02 +0800
602
+
603
+ ActionController::RoutingError (No route matches "/"):
604
+
605
+
606
+ Rendered /Users/fadhlirahim/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.9ms)
607
+
608
+
609
+ Started GET "/exceptions" for 127.0.0.1 at 2011-02-17 17:26:07 +0800
610
+ Processing by ExceptionsController#index as HTML
611
+ Rendered /Users/fadhlirahim/Projects/exception_engine/app/views/exceptions/index.html.erb within layouts/application (693.5ms)
612
+ Completed 200 OK in 856ms (Views: 766.5ms | ActiveRecord: 0.0ms)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: exception_engine
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Muhammad Fadhli Rahim
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-10 00:00:00 +08:00
13
+ date: 2011-02-17 00:00:00 +08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -67,6 +67,11 @@ files:
67
67
  - LICENSE.txt
68
68
  - Rakefile
69
69
  - README.rdoc
70
+ - app/controllers/exceptions_controller.rb
71
+ - app/models/exception_engine/backtrace_data.rb
72
+ - app/models/exception_engine/data.rb
73
+ - app/views/exceptions/index.html.erb
74
+ - config/routes.rb
70
75
  - test/dummy/app/controllers/application_controller.rb
71
76
  - test/dummy/app/controllers/posts_controller.rb
72
77
  - test/dummy/app/helpers/application_helper.rb
@@ -105,7 +110,6 @@ files:
105
110
  - test/dummy/public/javascripts/rails.js
106
111
  - test/dummy/Rakefile
107
112
  - test/dummy/script/rails
108
- - test/dummy/tmp/pids/server.pid
109
113
  - test/exception_engine_test.rb
110
114
  - test/integration/navigation_test.rb
111
115
  - test/support/integration_case.rb
@@ -177,7 +181,6 @@ test_files:
177
181
  - test/dummy/public/javascripts/rails.js
178
182
  - test/dummy/Rakefile
179
183
  - test/dummy/script/rails
180
- - test/dummy/tmp/pids/server.pid
181
184
  - test/exception_engine_test.rb
182
185
  - test/integration/navigation_test.rb
183
186
  - test/support/integration_case.rb
@@ -1 +0,0 @@
1
- 1545