better_errors 0.8.0 → 0.9.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 092b8845c91cd3c3ea3134d950e5c25075f19c96
4
- data.tar.gz: 989272a11a82a89c5fa51715d97ab6b27586760e
3
+ metadata.gz: 785a0ad660868a52fd48ab6d3b7c2f0271a9c32d
4
+ data.tar.gz: 40d2e1dab31d7aeca46c9d6761ab907e5c944b87
5
5
  SHA512:
6
- metadata.gz: 4a4f8df6ad24fe881afd99292f39826035cdbe77f3ccd7e751d1f0b123c6c8d805aebdd708d857e0f5de046a58f1f1ac6139cc9b90cc8247bf35644674474fbe
7
- data.tar.gz: 674c43d266041da8918725037d2227dddb6ac38d19e4122a581f719b90d4943d8c962fa31722be2d26d581ef01f134401bf3e7792cbfd2266410dc60068a4ccd
6
+ metadata.gz: 715085c73baaa36af3b73294f1de9d61b8dd44011e310f1d2145fe9156d624c8fe1f089c1558ad5156c37b7f9386c43eb4573e5e8e485a7e0cda6ef1c70fc82e
7
+ data.tar.gz: 56cf655e78b89ecdbd960008e7f77973ed91c2d2583ad6c3d6c0fa9cf1b88aa098c37525b7072f801b4e2ae62fdf371d2a8cbd2e947397063104900c6594c5d2
data/README.md CHANGED
@@ -51,6 +51,8 @@ Note that the `allow_ip!` is actually backed by a `Set`, so you can add more tha
51
51
 
52
52
  **Tip:** You can find your apparent IP by hitting the old error page's "Show env dump" and looking at "REMOTE_ADDR".
53
53
 
54
+ **VirtualBox:** If you are using VirtualBox and are accessing the guest from your host's browser, you will need to use `allow_ip!` to see the error page.
55
+
54
56
  ## Usage
55
57
 
56
58
  If you're using Rails, there's nothing else you need to do.
@@ -82,6 +84,19 @@ end
82
84
 
83
85
  [![Build Status](https://travis-ci.org/charliesome/better_errors.png)](https://travis-ci.org/charliesome/better_errors)
84
86
 
87
+ ### Unicorn, Puma, and other multi-worker servers
88
+
89
+ Better Errors works by leaving a lot of context in server process memory. If
90
+ you're using a web server that runs muliple "workers" it's likely that a second
91
+ request (as happens when you click on a stack frame) will hit a different
92
+ worker. That worker won't have the necessary context in memory, and you'll see
93
+ a `Session Expired` message.
94
+
95
+ If this is the case for you, consider turing the number of workers to one (1)
96
+ in `development`. Another option would be to use `rails server`, or another
97
+ single-process web server, when you are trying to troubleshoot an issue in
98
+ development.
99
+
85
100
  ## Get in touch!
86
101
 
87
102
  If you're using better_errors, I'd love to hear from you. Drop me a line and tell me what you think!
@@ -1,8 +1,8 @@
1
1
  class Exception
2
- original_initialize = instance_method(:initialize)
2
+ original_set_backtrace = instance_method(:set_backtrace)
3
3
 
4
4
  if BetterErrors.binding_of_caller_available?
5
- define_method :initialize do |*args|
5
+ define_method :set_backtrace do |*args|
6
6
  unless Thread.current[:__better_errors_exception_lock]
7
7
  Thread.current[:__better_errors_exception_lock] = true
8
8
  begin
@@ -11,7 +11,7 @@ class Exception
11
11
  Thread.current[:__better_errors_exception_lock] = false
12
12
  end
13
13
  end
14
- original_initialize.bind(self).call(*args)
14
+ original_set_backtrace.bind(self).call(*args)
15
15
  end
16
16
  end
17
17
 
@@ -48,10 +48,10 @@ module BetterErrors
48
48
  end
49
49
 
50
50
  def gem_path
51
- Gem.path.each do |path|
52
- if filename.index(path) == 0
53
- return filename.gsub("#{path}/gems/", "(gem) ")
54
- end
51
+ if path = Gem.path.detect { |path| filename.index(path) == 0 }
52
+ gem_name_and_version, path = filename.sub("#{path}/gems/", "").split("/", 2)
53
+ /(?<gem_name>.+)-(?<gem_version>[\w.]+)/ =~ gem_name_and_version
54
+ "#{gem_name} (#{gem_version}) #{path}"
55
55
  end
56
56
  end
57
57
 
@@ -680,7 +680,18 @@
680
680
  host app.
681
681
  %>
682
682
  <script>
683
- if (window.Turbolinks) document.head.innerHTML = "";
683
+ if (window.Turbolinks) {
684
+ for(var i=0; i < document.styleSheets.length; i++) {
685
+ if(document.styleSheets[i].href)
686
+ document.styleSheets[i].disabled = true;
687
+ }
688
+ document.addEventListener("page:restore", function restoreCSS(e) {
689
+ for(var i=0; i < document.styleSheets.length; i++) {
690
+ document.styleSheets[i].disabled = false;
691
+ }
692
+ document.removeEventListener("page:restore", restoreCSS, false);
693
+ });
694
+ }
684
695
  </script>
685
696
 
686
697
  <div class='top'>
@@ -1,3 +1,3 @@
1
1
  module BetterErrors
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -54,7 +54,7 @@ module BetterErrors
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
- frame.gem_path.should == "(gem) whatever-1.2.3/lib/whatever.rb"
57
+ frame.gem_path.should == "whatever (1.2.3) lib/whatever.rb"
58
58
  end
59
59
 
60
60
  it "should prioritize gem path over application path" do
@@ -62,7 +62,7 @@ module BetterErrors
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
- frame.gem_path.should == "(gem) whatever-1.2.3/lib/whatever.rb"
65
+ frame.gem_path.should == "whatever (1.2.3) lib/whatever.rb"
66
66
  end
67
67
  end
68
68
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
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-04-04 00:00:00.000000000 Z
11
+ date: 2013-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  requirements: []
203
203
  rubyforge_project:
204
- rubygems_version: 2.0.0
204
+ rubygems_version: 2.0.3
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Better error page for Rails and other Rack apps