better_errors 1.1.0 → 2.1.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.
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title><%= exception.class %> at <%= request_path %></title>
4
+ <title><%= exception.type %> at <%= request_path %></title>
5
5
  </head>
6
6
  <body>
7
7
  <%# Stylesheets are placed in the <body> for Turbolinks compatibility. %>
@@ -182,7 +182,7 @@
182
182
  word-wrap: break-word;
183
183
  white-space: pre-wrap;
184
184
  height: auto;
185
- max-height: 7em;
185
+ max-height: 7.5em;
186
186
  }
187
187
 
188
188
  @media screen and (max-width: 1100px) {
@@ -731,8 +731,8 @@
731
731
 
732
732
  <div class='top'>
733
733
  <header class="exception">
734
- <h2><strong><%= exception.class %></strong> <span>at <%= request_path %></span></h2>
735
- <p><%= exception_message %></p>
734
+ <h2><strong><%= exception.type %></strong> <span>at <%= request_path %></span></h2>
735
+ <p><%= exception.message %></p>
736
736
  </header>
737
737
  </div>
738
738
 
@@ -768,7 +768,7 @@
768
768
  <script>
769
769
  (function() {
770
770
 
771
- var OID = <%== object_id.to_s.inspect %>;
771
+ var OID = "<%= id %>";
772
772
 
773
773
  var previousFrame = null;
774
774
  var previousFrameInfo = null;
@@ -875,6 +875,7 @@
875
875
  this.previousCommandOffset = previousCommands.push(text);
876
876
  if(previousCommands.length > 100) {
877
877
  previousCommands.splice(0, 1);
878
+ this.previousCommandOffset -= 1;
878
879
  }
879
880
  localStorage.setItem("better_errors_previous_commands", JSON.stringify(previousCommands));
880
881
  }
@@ -1,6 +1,6 @@
1
- <%== text_heading("=", "%s at %s" % [exception.class, request_path]) %>
1
+ <%== text_heading("=", "%s at %s" % [exception.type, request_path]) %>
2
2
 
3
- > <%== exception_message %>
3
+ > <%== exception.message %>
4
4
  <% if backtrace_frames.any? %>
5
5
 
6
6
  <%== text_heading("-", "%s, line %i" % [first_frame.pretty_path, first_frame.line]) %>
@@ -1,3 +1,3 @@
1
1
  module BetterErrors
2
- VERSION = "1.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
data/lib/better_errors.rb CHANGED
@@ -3,12 +3,13 @@ require "erubis"
3
3
  require "coderay"
4
4
  require "uri"
5
5
 
6
- require "better_errors/version"
6
+ require "better_errors/code_formatter"
7
7
  require "better_errors/error_page"
8
- require "better_errors/stack_frame"
9
8
  require "better_errors/middleware"
10
- require "better_errors/code_formatter"
9
+ require "better_errors/raised_exception"
11
10
  require "better_errors/repl"
11
+ require "better_errors/stack_frame"
12
+ require "better_errors/version"
12
13
 
13
14
  module BetterErrors
14
15
  POSSIBLE_EDITOR_PRESETS = [
@@ -136,11 +137,10 @@ end
136
137
 
137
138
  begin
138
139
  require "binding_of_caller"
140
+ require "better_errors/exception_extension"
139
141
  BetterErrors.binding_of_caller_available = true
140
- rescue LoadError => e
142
+ rescue LoadError
141
143
  BetterErrors.binding_of_caller_available = false
142
144
  end
143
145
 
144
- require "better_errors/core_ext/exception"
145
-
146
146
  require "better_errors/rails" if defined? Rails::Railtie
@@ -3,16 +3,16 @@ require "spec_helper"
3
3
  module BetterErrors
4
4
  describe CodeFormatter do
5
5
  let(:filename) { File.expand_path("../support/my_source.rb", __FILE__) }
6
-
6
+
7
7
  let(:formatter) { CodeFormatter.new(filename, 8) }
8
-
8
+
9
9
  it "picks an appropriate scanner" do
10
10
  formatter.coderay_scanner.should == :ruby
11
11
  end
12
-
12
+
13
13
  it "shows 5 lines of context" do
14
14
  formatter.line_range.should == (3..13)
15
-
15
+
16
16
  formatter.context_lines.should == [
17
17
  "three\n",
18
18
  "four\n",
@@ -43,12 +43,12 @@ module BetterErrors
43
43
  formatter = CodeFormatter::HTML.new(filename, 20)
44
44
  formatter.output.should_not == formatter.source_unavailable
45
45
  end
46
-
46
+
47
47
  it "doesn't barf when the lines don't make any sense" do
48
48
  formatter = CodeFormatter::HTML.new(filename, 999)
49
49
  formatter.output.should == formatter.source_unavailable
50
50
  end
51
-
51
+
52
52
  it "doesn't barf when the file doesn't exist" do
53
53
  formatter = CodeFormatter::HTML.new("fkdguhskd7e l", 1)
54
54
  formatter.output.should == formatter.source_unavailable
@@ -82,7 +82,7 @@ module BetterErrors
82
82
  formatter = CodeFormatter::Text.new(filename, 999)
83
83
  formatter.output.should == formatter.source_unavailable
84
84
  end
85
-
85
+
86
86
  it "doesn't barf when the file doesn't exist" do
87
87
  formatter = CodeFormatter::Text.new("fkdguhskd7e l", 1)
88
88
  formatter.output.should == formatter.source_unavailable
@@ -3,36 +3,36 @@ require "spec_helper"
3
3
  module BetterErrors
4
4
  describe ErrorPage do
5
5
  let!(:exception) { raise ZeroDivisionError, "you divided by zero you silly goose!" rescue $! }
6
-
6
+
7
7
  let(:error_page) { ErrorPage.new exception, { "PATH_INFO" => "/some/path" } }
8
-
8
+
9
9
  let(:response) { error_page.render }
10
-
10
+
11
11
  let(:empty_binding) {
12
12
  local_a = :value_for_local_a
13
13
  local_b = :value_for_local_b
14
-
14
+
15
15
  @inst_c = :value_for_inst_c
16
16
  @inst_d = :value_for_inst_d
17
-
17
+
18
18
  binding
19
19
  }
20
-
20
+
21
21
  it "includes the error message" do
22
22
  response.should include("you divided by zero you silly goose!")
23
23
  end
24
-
24
+
25
25
  it "includes the request path" do
26
26
  response.should include("/some/path")
27
27
  end
28
-
28
+
29
29
  it "includes the exception class" do
30
30
  response.should include("ZeroDivisionError")
31
31
  end
32
-
32
+
33
33
  context "variable inspection" do
34
34
  let(:exception) { empty_binding.eval("raise") rescue $! }
35
-
35
+
36
36
  if BetterErrors.binding_of_caller_available?
37
37
  it "shows local variables" do
38
38
  html = error_page.do_variables("index" => 0)[:html]
@@ -47,7 +47,7 @@ module BetterErrors
47
47
  html.should include(%{gem "binding_of_caller"})
48
48
  end
49
49
  end
50
-
50
+
51
51
  it "shows instance variables" do
52
52
  html = error_page.do_variables("index" => 0)[:html]
53
53
  html.should include("inst_c")
@@ -65,7 +65,7 @@ module BetterErrors
65
65
  html.should_not include("<pre>:value_for_inst_d</pre>")
66
66
  end
67
67
  end
68
-
68
+
69
69
  it "doesn't die if the source file is not a real filename" do
70
70
  exception.stub(:backtrace).and_return([
71
71
  "<internal:prelude>:10:in `spawn_rack_application'"
@@ -40,6 +40,14 @@ module BetterErrors
40
40
  app.call("REMOTE_ADDR" => "77.55.33.11")
41
41
  end
42
42
 
43
+ it "respects the X-Forwarded-For header" do
44
+ app.should_not_receive :better_errors_call
45
+ app.call(
46
+ "REMOTE_ADDR" => "127.0.0.1",
47
+ "HTTP_X_FORWARDED_FOR" => "1.2.3.4",
48
+ )
49
+ end
50
+
43
51
  it "doesn't blow up when given a blank REMOTE_ADDR" do
44
52
  expect { app.call("REMOTE_ADDR" => " ") }.to_not raise_error
45
53
  end
@@ -0,0 +1,72 @@
1
+ require "spec_helper"
2
+
3
+ module BetterErrors
4
+ describe RaisedException do
5
+ let(:exception) { RuntimeError.new("whoops") }
6
+ subject { RaisedException.new(exception) }
7
+
8
+ its(:exception) { should == exception }
9
+ its(:message) { should == "whoops" }
10
+ its(:type) { should == RuntimeError }
11
+
12
+ context "when the exception wraps another exception" do
13
+ let(:original_exception) { RuntimeError.new("something went wrong!") }
14
+ let(:exception) { double(:original_exception => original_exception) }
15
+
16
+ its(:exception) { should == original_exception }
17
+ its(:message) { should == "something went wrong!" }
18
+ end
19
+
20
+ context "when the exception is a syntax error" do
21
+ let(:exception) { SyntaxError.new("foo.rb:123: you made a typo!") }
22
+
23
+ its(:message) { should == "you made a typo!" }
24
+ its(:type) { should == SyntaxError }
25
+
26
+ it "has the right filename and line number in the backtrace" do
27
+ subject.backtrace.first.filename.should == "foo.rb"
28
+ subject.backtrace.first.line.should == 123
29
+ end
30
+ end
31
+
32
+ context "when the exception is a HAML syntax error" do
33
+ before do
34
+ stub_const("Haml::SyntaxError", Class.new(SyntaxError))
35
+ end
36
+
37
+ let(:exception) {
38
+ Haml::SyntaxError.new("you made a typo!").tap do |ex|
39
+ ex.set_backtrace(["foo.rb:123", "haml/internals/blah.rb:123456"])
40
+ end
41
+ }
42
+
43
+ its(:message) { should == "you made a typo!" }
44
+ its(:type) { should == Haml::SyntaxError }
45
+
46
+ it "has the right filename and line number in the backtrace" do
47
+ subject.backtrace.first.filename.should == "foo.rb"
48
+ subject.backtrace.first.line.should == 123
49
+ end
50
+ end
51
+
52
+ context "when the exception is a Coffeelint syntax error" do
53
+ before do
54
+ stub_const("Sprockets::Coffeelint::Error", Class.new(SyntaxError))
55
+ end
56
+
57
+ let(:exception) {
58
+ Sprockets::Coffeelint::Error.new("[stdin]:11:88: error: unexpected=").tap do |ex|
59
+ ex.set_backtrace(["app/assets/javascripts/files/index.coffee:11", "sprockets/coffeelint.rb:3"])
60
+ end
61
+ }
62
+
63
+ its(:message) { should == "[stdin]:11:88: error: unexpected=" }
64
+ its(:type) { should == Sprockets::Coffeelint::Error }
65
+
66
+ it "has the right filename and line number in the backtrace" do
67
+ subject.backtrace.first.filename.should == "app/assets/javascripts/files/index.coffee"
68
+ subject.backtrace.first.line.should == 11
69
+ end
70
+ end
71
+ end
72
+ end
@@ -9,7 +9,7 @@ module BetterErrors
9
9
  local_a = 123
10
10
  binding
11
11
  }
12
-
12
+
13
13
  let(:repl) { Basic.new fresh_binding }
14
14
 
15
15
  it_behaves_like "a REPL provider"
@@ -3,13 +3,13 @@ shared_examples_for "a REPL provider" do
3
3
  repl.send_input("local_a = 456")
4
4
  fresh_binding.eval("local_a").should == 456
5
5
  end
6
-
6
+
7
7
  it "returns a tuple of output and the new prompt" do
8
8
  output, prompt = repl.send_input("1 + 2")
9
9
  output.should == "=> 3\n"
10
10
  prompt.should == ">>"
11
11
  end
12
-
12
+
13
13
  it "doesn't barf if the code throws an exception" do
14
14
  output, prompt = repl.send_input("raise Exception")
15
15
  output.should include "Exception: Exception"
@@ -6,77 +6,77 @@ module BetterErrors
6
6
  it "is true for application filenames" do
7
7
  BetterErrors.stub(:application_root).and_return("/abc/xyz")
8
8
  frame = StackFrame.new("/abc/xyz/app/controllers/crap_controller.rb", 123, "index")
9
-
10
- frame.application?.should be_true
9
+
10
+ frame.should be_application
11
11
  end
12
-
12
+
13
13
  it "is false for everything else" do
14
14
  BetterErrors.stub(:application_root).and_return("/abc/xyz")
15
15
  frame = StackFrame.new("/abc/nope", 123, "foo")
16
-
17
- frame.application?.should be_false
16
+
17
+ frame.should_not be_application
18
18
  end
19
-
19
+
20
20
  it "doesn't care if no application_root is set" do
21
21
  frame = StackFrame.new("/abc/xyz/app/controllers/crap_controller.rb", 123, "index")
22
-
23
- frame.application?.should be_false
22
+
23
+ frame.should_not be_application
24
24
  end
25
25
  end
26
-
26
+
27
27
  context "#gem?" do
28
28
  it "is true for gem filenames" do
29
29
  Gem.stub(:path).and_return(["/abc/xyz"])
30
30
  frame = StackFrame.new("/abc/xyz/gems/whatever-1.2.3/lib/whatever.rb", 123, "foo")
31
-
32
- frame.gem?.should be_true
31
+
32
+ frame.should be_gem
33
33
  end
34
-
34
+
35
35
  it "is false for everything else" do
36
36
  Gem.stub(:path).and_return(["/abc/xyz"])
37
37
  frame = StackFrame.new("/abc/nope", 123, "foo")
38
-
39
- frame.gem?.should be_false
38
+
39
+ frame.should_not be_gem
40
40
  end
41
41
  end
42
-
42
+
43
43
  context "#application_path" do
44
44
  it "chops off the application root" do
45
45
  BetterErrors.stub(:application_root).and_return("/abc/xyz")
46
46
  frame = StackFrame.new("/abc/xyz/app/controllers/crap_controller.rb", 123, "index")
47
-
47
+
48
48
  frame.application_path.should == "app/controllers/crap_controller.rb"
49
49
  end
50
50
  end
51
-
51
+
52
52
  context "#gem_path" do
53
53
  it "chops of the gem path and stick (gem) there" do
54
54
  Gem.stub(:path).and_return(["/abc/xyz"])
55
55
  frame = StackFrame.new("/abc/xyz/gems/whatever-1.2.3/lib/whatever.rb", 123, "foo")
56
-
56
+
57
57
  frame.gem_path.should == "whatever (1.2.3) lib/whatever.rb"
58
58
  end
59
-
59
+
60
60
  it "prioritizes gem path over application path" do
61
61
  BetterErrors.stub(:application_root).and_return("/abc/xyz")
62
62
  Gem.stub(:path).and_return(["/abc/xyz/vendor"])
63
63
  frame = StackFrame.new("/abc/xyz/vendor/gems/whatever-1.2.3/lib/whatever.rb", 123, "foo")
64
-
64
+
65
65
  frame.gem_path.should == "whatever (1.2.3) lib/whatever.rb"
66
66
  end
67
67
  end
68
-
68
+
69
69
  context "#pretty_path" do
70
70
  it "returns #application_path for application paths" do
71
71
  BetterErrors.stub(:application_root).and_return("/abc/xyz")
72
72
  frame = StackFrame.new("/abc/xyz/app/controllers/crap_controller.rb", 123, "index")
73
73
  frame.pretty_path.should == frame.application_path
74
74
  end
75
-
75
+
76
76
  it "returns #gem_path for gem paths" do
77
77
  Gem.stub(:path).and_return(["/abc/xyz"])
78
78
  frame = StackFrame.new("/abc/xyz/gems/whatever-1.2.3/lib/whatever.rb", 123, "foo")
79
-
79
+
80
80
  frame.pretty_path.should == frame.gem_path
81
81
  end
82
82
  end
@@ -90,28 +90,28 @@ module BetterErrors
90
90
  frames.first.filename.should == "my_file.rb"
91
91
  frames.first.line.should == 123
92
92
  end
93
-
93
+
94
94
  it "doesn't blow up if no method name is given" do
95
95
  error = StandardError.allocate
96
-
96
+
97
97
  error.stub(:backtrace).and_return(["foo.rb:123"])
98
98
  frames = StackFrame.from_exception(error)
99
99
  frames.first.filename.should == "foo.rb"
100
100
  frames.first.line.should == 123
101
-
101
+
102
102
  error.stub(:backtrace).and_return(["foo.rb:123: this is an error message"])
103
103
  frames = StackFrame.from_exception(error)
104
104
  frames.first.filename.should == "foo.rb"
105
105
  frames.first.line.should == 123
106
106
  end
107
-
107
+
108
108
  it "ignores a backtrace line if its format doesn't make any sense at all" do
109
109
  error = StandardError.allocate
110
110
  error.stub(:backtrace).and_return(["foo.rb:123:in `foo'", "C:in `find'", "bar.rb:123:in `bar'"])
111
111
  frames = StackFrame.from_exception(error)
112
112
  frames.count.should == 2
113
113
  end
114
-
114
+
115
115
  it "doesn't blow up if a filename contains a colon" do
116
116
  error = StandardError.allocate
117
117
  error.stub(:backtrace).and_return(["crap:filename.rb:123"])
@@ -125,11 +125,7 @@ module BetterErrors
125
125
  ::Kernel.binding
126
126
  end
127
127
  frame = StackFrame.new("/abc/xyz/app/controllers/crap_controller.rb", 123, "index", obj.my_binding)
128
- if RUBY_VERSION >= "2.0.0"
129
- frame.class_name.should == 'BasicObject'
130
- else
131
- frame.class_name.should be_nil
132
- end
128
+ frame.class_name.should == 'BasicObject'
133
129
  end
134
130
 
135
131
  it "sets method names properly" do
@@ -143,12 +139,12 @@ module BetterErrors
143
139
  end
144
140
 
145
141
  frame = StackFrame.from_exception(obj.my_method).first
146
- if RUBY_VERSION >= "2.0.0"
142
+ if BetterErrors.binding_of_caller_available?
147
143
  frame.method_name.should == "#my_method"
148
144
  frame.class_name.should == "String"
149
145
  else
150
146
  frame.method_name.should == "my_method"
151
- frame.class_name.should be_nil
147
+ frame.class_name.should == nil
152
148
  end
153
149
  end
154
150
 
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,5 @@
1
- require "simplecov"
2
- SimpleCov.start
3
-
4
1
  $: << File.expand_path("../../lib", __FILE__)
2
+
5
3
  ENV["EDITOR"] = nil
4
+
6
5
  require "better_errors"
7
- require "ostruct"
@@ -0,0 +1,9 @@
1
+ module Kernel
2
+ alias_method :require_with_binding_of_caller, :require
3
+
4
+ def require(feature)
5
+ raise LoadError if feature == "binding_of_caller"
6
+
7
+ require_with_binding_of_caller(feature)
8
+ end
9
+ end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Somerville
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-23 00:00:00.000000000 Z
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 2.6.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.6.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coderay
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.0
41
55
  description: Provides a better error page for Rails and other Rack apps. Includes
42
56
  source code inspection, a live REPL and local/instance variable inspection for all
43
57
  stack frames.
@@ -47,9 +61,9 @@ executables: []
47
61
  extensions: []
48
62
  extra_rdoc_files: []
49
63
  files:
50
- - .gitignore
51
- - .travis.yml
52
- - .yardopts
64
+ - ".gitignore"
65
+ - ".travis.yml"
66
+ - ".yardopts"
53
67
  - CHANGELOG.md
54
68
  - Gemfile
55
69
  - LICENSE.txt
@@ -60,10 +74,11 @@ files:
60
74
  - lib/better_errors/code_formatter.rb
61
75
  - lib/better_errors/code_formatter/html.rb
62
76
  - lib/better_errors/code_formatter/text.rb
63
- - lib/better_errors/core_ext/exception.rb
64
77
  - lib/better_errors/error_page.rb
78
+ - lib/better_errors/exception_extension.rb
65
79
  - lib/better_errors/middleware.rb
66
80
  - lib/better_errors/rails.rb
81
+ - lib/better_errors/raised_exception.rb
67
82
  - lib/better_errors/repl.rb
68
83
  - lib/better_errors/repl/basic.rb
69
84
  - lib/better_errors/repl/pry.rb
@@ -75,6 +90,7 @@ files:
75
90
  - spec/better_errors/code_formatter_spec.rb
76
91
  - spec/better_errors/error_page_spec.rb
77
92
  - spec/better_errors/middleware_spec.rb
93
+ - spec/better_errors/raised_exception_spec.rb
78
94
  - spec/better_errors/repl/basic_spec.rb
79
95
  - spec/better_errors/repl/pry_spec.rb
80
96
  - spec/better_errors/repl/shared_examples.rb
@@ -82,6 +98,7 @@ files:
82
98
  - spec/better_errors/support/my_source.rb
83
99
  - spec/better_errors_spec.rb
84
100
  - spec/spec_helper.rb
101
+ - spec/without_binding_of_caller.rb
85
102
  homepage: https://github.com/charliesome/better_errors
86
103
  licenses:
87
104
  - MIT
@@ -92,17 +109,17 @@ require_paths:
92
109
  - lib
93
110
  required_ruby_version: !ruby/object:Gem::Requirement
94
111
  requirements:
95
- - - '>='
112
+ - - ">="
96
113
  - !ruby/object:Gem::Version
97
- version: 1.9.2
114
+ version: 2.0.0
98
115
  required_rubygems_version: !ruby/object:Gem::Requirement
99
116
  requirements:
100
- - - '>='
117
+ - - ">="
101
118
  - !ruby/object:Gem::Version
102
119
  version: '0'
103
120
  requirements: []
104
121
  rubyforge_project:
105
- rubygems_version: 2.0.3
122
+ rubygems_version: 2.2.2
106
123
  signing_key:
107
124
  specification_version: 4
108
125
  summary: Better error page for Rails and other Rack apps
@@ -110,6 +127,7 @@ test_files:
110
127
  - spec/better_errors/code_formatter_spec.rb
111
128
  - spec/better_errors/error_page_spec.rb
112
129
  - spec/better_errors/middleware_spec.rb
130
+ - spec/better_errors/raised_exception_spec.rb
113
131
  - spec/better_errors/repl/basic_spec.rb
114
132
  - spec/better_errors/repl/pry_spec.rb
115
133
  - spec/better_errors/repl/shared_examples.rb
@@ -117,4 +135,4 @@ test_files:
117
135
  - spec/better_errors/support/my_source.rb
118
136
  - spec/better_errors_spec.rb
119
137
  - spec/spec_helper.rb
120
- has_rdoc:
138
+ - spec/without_binding_of_caller.rb
@@ -1,21 +0,0 @@
1
- class Exception
2
- original_set_backtrace = instance_method(:set_backtrace)
3
-
4
- if BetterErrors.binding_of_caller_available?
5
- define_method :set_backtrace do |*args|
6
- unless Thread.current[:__better_errors_exception_lock]
7
- Thread.current[:__better_errors_exception_lock] = true
8
- begin
9
- @__better_errors_bindings_stack = binding.callers.drop(1)
10
- ensure
11
- Thread.current[:__better_errors_exception_lock] = false
12
- end
13
- end
14
- original_set_backtrace.bind(self).call(*args)
15
- end
16
- end
17
-
18
- def __better_errors_bindings_stack
19
- @__better_errors_bindings_stack || []
20
- end
21
- end