better_errors 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of better_errors might be problematic. Click here for more details.
- data/README.md +0 -4
- data/TIPS_AND_TRICKS.md +39 -0
- data/lib/better_errors/rails.rb +18 -2
- data/lib/better_errors/templates/main.erb +10 -1
- data/lib/better_errors/version.rb +1 -1
- metadata +22 -28
data/README.md
CHANGED
@@ -62,10 +62,6 @@ end
|
|
62
62
|
* **Coming soon**
|
63
63
|
* MRI 2.0.0 - the official API for grabbing caller bindings is slated for MRI 2.0.0, but it has not been implemented yet
|
64
64
|
|
65
|
-
## Known issues
|
66
|
-
|
67
|
-
* Calling `yield` from the REPL segfaults MRI 1.9.x.
|
68
|
-
|
69
65
|
## Get in touch!
|
70
66
|
|
71
67
|
If you're using better_errors, I'd love to hear from you. Drop me a line and tell me what you think!
|
data/TIPS_AND_TRICKS.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Tips and Tricks
|
2
|
+
|
3
|
+
Below are a collection of handy tips and tricks submitted by users to help you get the most out of Better Errors.
|
4
|
+
|
5
|
+
If you know something you think would be valuable to share, please do! Pull requests are always appreciated.
|
6
|
+
|
7
|
+
### View last error
|
8
|
+
|
9
|
+
Better Errors saves the most recent error page displayed at `/__better_errors`.
|
10
|
+
|
11
|
+
This can be handy if you aren't able to see the error page served up when the exception occurred, eg. if the errored request was an AJAX or curl request.
|
12
|
+
|
13
|
+
### Adjusting the project base path for the editor link
|
14
|
+
|
15
|
+
If your Rails app is running from a shared folder in a VM, the path to your source files from Rails' perspective could be different to the path seen by your editor.
|
16
|
+
|
17
|
+
You can adjust the path used to generate open-in-editor links by putting this snippet of code in an initializer:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
if defined? BetterErrors
|
21
|
+
BetterErrors.editor = proc { |full_path, line|
|
22
|
+
full_path = full_path.sub(Rails.root.to_s, your_local_path)
|
23
|
+
"my-editor://open?url=file://#{full_path}&line=#{line}"
|
24
|
+
}
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
If you're working on a project with other developers, your base path may be not be the same as the other developers'.
|
29
|
+
|
30
|
+
You can use an environment variable to work around this by replacing `your_local_path` in the snippet above with `ENV["BETTER_ERRORS_PROJECT_PATH"]` and starting your Rails server like this:
|
31
|
+
|
32
|
+
```shell
|
33
|
+
$ BETTER_ERRORS_PROJECT_PATH=/path/to/your/app rails server
|
34
|
+
```
|
35
|
+
|
36
|
+
### Opening files in RubyMine
|
37
|
+
|
38
|
+
Users of RubyMine on OS X can follow the instructions provided at http://devnet.jetbrains.com/message/5477503 to configure Better Errors to open files in RubyMine.
|
39
|
+
|
data/lib/better_errors/rails.rb
CHANGED
@@ -2,11 +2,27 @@ module BetterErrors
|
|
2
2
|
# @private
|
3
3
|
class Railtie < Rails::Railtie
|
4
4
|
initializer "better_errors.configure_rails_initialization" do
|
5
|
-
|
6
|
-
|
5
|
+
if use_better_errors?
|
6
|
+
insert_middleware
|
7
7
|
BetterErrors.logger = Rails.logger
|
8
8
|
BetterErrors.application_root = Rails.root.to_s
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
def insert_middleware
|
13
|
+
if defined? ActionDispatch::DebugExceptions
|
14
|
+
app.middleware.insert_after ActionDispatch::DebugExceptions, BetterErrors::Middleware
|
15
|
+
else
|
16
|
+
app.middleware.use BetterErrors::Middleware
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def use_better_errors?
|
21
|
+
!Rails.env.production? and app.config.consider_all_requests_local
|
22
|
+
end
|
23
|
+
|
24
|
+
def app
|
25
|
+
Rails.application
|
26
|
+
end
|
11
27
|
end
|
12
28
|
end
|
@@ -4,7 +4,6 @@
|
|
4
4
|
<title><%= exception.class %> at <%= request_path %></title>
|
5
5
|
</head>
|
6
6
|
<body>
|
7
|
-
|
8
7
|
<%# Stylesheets are placed in the <body> for Turbolinks compatibility. %>
|
9
8
|
<style>
|
10
9
|
/* Basic reset */
|
@@ -665,6 +664,16 @@
|
|
665
664
|
}
|
666
665
|
</style>
|
667
666
|
|
667
|
+
<%# IE8 compatibility crap %>
|
668
|
+
<script>
|
669
|
+
(function() {
|
670
|
+
var elements = ["section", "nav", "header", "footer", "audio"];
|
671
|
+
for (var i = 0; i < elements.length; i++) {
|
672
|
+
document.createElement(elements[i]);
|
673
|
+
}
|
674
|
+
})();
|
675
|
+
</script>
|
676
|
+
|
668
677
|
<%#
|
669
678
|
If Rails's Turbolinks is used, the Better Errors page is probably
|
670
679
|
rendered in the host app's layout. Let's empty out the styles of the
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
type: :development
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
type: :development
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
type: :development
|
@@ -88,7 +88,7 @@ dependencies:
|
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - '>='
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
type: :development
|
@@ -104,7 +104,7 @@ dependencies:
|
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
@@ -112,7 +112,7 @@ dependencies:
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
@@ -128,7 +128,7 @@ dependencies:
|
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
|
-
- -
|
131
|
+
- - '>='
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: 2.6.6
|
134
134
|
type: :runtime
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
none: false
|
138
138
|
requirements:
|
139
|
-
- -
|
139
|
+
- - '>='
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: 2.6.6
|
142
142
|
- !ruby/object:Gem::Dependency
|
@@ -144,7 +144,7 @@ dependencies:
|
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
none: false
|
146
146
|
requirements:
|
147
|
-
- -
|
147
|
+
- - '>='
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: 1.0.0
|
150
150
|
type: :runtime
|
@@ -152,7 +152,7 @@ dependencies:
|
|
152
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
153
|
none: false
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: 1.0.0
|
158
158
|
description: Provides a better error page for Rails and other Rack apps. Includes
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- LICENSE.txt
|
172
172
|
- README.md
|
173
173
|
- Rakefile
|
174
|
+
- TIPS_AND_TRICKS.md
|
174
175
|
- better_errors.gemspec
|
175
176
|
- lib/better_errors.rb
|
176
177
|
- lib/better_errors/code_formatter.rb
|
@@ -208,24 +209,18 @@ require_paths:
|
|
208
209
|
required_ruby_version: !ruby/object:Gem::Requirement
|
209
210
|
none: false
|
210
211
|
requirements:
|
211
|
-
- -
|
212
|
+
- - '>='
|
212
213
|
- !ruby/object:Gem::Version
|
213
214
|
version: '0'
|
214
|
-
segments:
|
215
|
-
- 0
|
216
|
-
hash: -1514096288284811368
|
217
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
216
|
none: false
|
219
217
|
requirements:
|
220
|
-
- -
|
218
|
+
- - '>='
|
221
219
|
- !ruby/object:Gem::Version
|
222
220
|
version: '0'
|
223
|
-
segments:
|
224
|
-
- 0
|
225
|
-
hash: -1514096288284811368
|
226
221
|
requirements: []
|
227
222
|
rubyforge_project:
|
228
|
-
rubygems_version: 1.8.
|
223
|
+
rubygems_version: 1.8.25
|
229
224
|
signing_key:
|
230
225
|
specification_version: 3
|
231
226
|
summary: Better error page for Rails and other Rack apps
|
@@ -240,4 +235,3 @@ test_files:
|
|
240
235
|
- spec/better_errors/support/my_source.rb
|
241
236
|
- spec/better_errors_spec.rb
|
242
237
|
- spec/spec_helper.rb
|
243
|
-
has_rdoc:
|