exception_engine 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/exceptions_controller.rb +7 -0
- data/app/models/exception_engine/backtrace_data.rb +10 -0
- data/app/models/exception_engine/data.rb +25 -0
- data/app/views/exceptions/index.html.erb +30 -0
- data/config/routes.rb +3 -0
- data/lib/exception_engine/version.rb +1 -1
- data/test/dummy/log/development.log +28 -0
- metadata +7 -4
- data/test/dummy/tmp/pids/server.pid +0 -1
@@ -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
@@ -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.
|
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-
|
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
|