better_errors 2.7.1 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -90,7 +90,7 @@
90
90
  nav.sidebar,
91
91
  .frame_info {
92
92
  position: fixed;
93
- top: 95px;
93
+ top: 102px;
94
94
  bottom: 0;
95
95
 
96
96
  box-sizing: border-box;
@@ -102,7 +102,7 @@
102
102
  nav.sidebar {
103
103
  width: 40%;
104
104
  left: 20px;
105
- top: 115px;
105
+ top: 122px;
106
106
  bottom: 20px;
107
107
  }
108
108
 
@@ -131,7 +131,7 @@
131
131
  header.exception {
132
132
  padding: 18px 20px;
133
133
 
134
- height: 59px;
134
+ height: 66px;
135
135
  min-height: 59px;
136
136
 
137
137
  overflow: hidden;
@@ -146,6 +146,14 @@
146
146
  }
147
147
 
148
148
  /* Heading */
149
+ header.exception .fix-actions {
150
+ margin-top: .5em;
151
+ }
152
+
153
+ header.exception .fix-actions input[type=submit] {
154
+ font-weight: bold;
155
+ }
156
+
149
157
  header.exception h2 {
150
158
  font-weight: 200;
151
159
  font-size: 11pt;
@@ -153,7 +161,7 @@
153
161
 
154
162
  header.exception h2,
155
163
  header.exception p {
156
- line-height: 1.4em;
164
+ line-height: 1.5em;
157
165
  overflow: hidden;
158
166
  white-space: pre;
159
167
  text-overflow: ellipsis;
@@ -166,7 +174,7 @@
166
174
 
167
175
  header.exception p {
168
176
  font-weight: 200;
169
- font-size: 20pt;
177
+ font-size: 17pt;
170
178
  color: white;
171
179
  }
172
180
 
@@ -587,6 +595,9 @@
587
595
  color: #8080a0;
588
596
  padding-left: 20px;
589
597
  }
598
+ .console-has-been-used .live-console-hint {
599
+ display: none;
600
+ }
590
601
 
591
602
  .hint:before {
592
603
  content: '\25b2';
@@ -603,17 +614,6 @@
603
614
  margin: 10px 0;
604
615
  }
605
616
 
606
- .sub:before {
607
- content: '';
608
- display: block;
609
- width: 100%;
610
- height: 4px;
611
-
612
- border-radius: 2px;
613
- background: rgba(0, 150, 200, 0.05);
614
- box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.7), inset 0 0 0 1px rgba(0, 0, 0, 0.04), inset 2px 2px 2px rgba(0, 0, 0, 0.07);
615
- }
616
-
617
617
  .sub h3 {
618
618
  color: #39a;
619
619
  font-size: 1.1em;
@@ -744,6 +744,21 @@
744
744
  <header class="exception">
745
745
  <h2><strong><%= exception_type %></strong> <span>at <%= request_path %></span></h2>
746
746
  <p><%= exception_message %></p>
747
+ <% unless active_support_actions.empty? %>
748
+ <div class='fix-actions'>
749
+ <% active_support_actions.each do |action, _| %>
750
+ <form class="button_to" method="post" action="<%= action_dispatch_action_endpoint %>">
751
+ <input type="submit" value="<%= action %>">
752
+ <input type="hidden" name="action" value="<%= action %>">
753
+ <input type="hidden" name="error" value="<%= exception_type %>">
754
+ <input type="hidden" name="location" value="<%= request_path %>">
755
+ </form>
756
+ <% end %>
757
+ </div>
758
+ <% end %>
759
+ <% if exception_hint %>
760
+ <h2>Hint: <%= exception_hint %></h2>
761
+ <% end %>
747
762
  </header>
748
763
  </div>
749
764
 
@@ -780,6 +795,7 @@
780
795
  (function() {
781
796
 
782
797
  var OID = "<%= id %>";
798
+ var csrfToken = "<%= csrf_token %>";
783
799
 
784
800
  var previousFrame = null;
785
801
  var previousFrameInfo = null;
@@ -790,6 +806,7 @@
790
806
  var req = new XMLHttpRequest();
791
807
  req.open("POST", "//" + window.location.host + <%== uri_prefix.gsub("<", "&lt;").inspect %> + "/__better_errors/" + OID + "/" + method, true);
792
808
  req.setRequestHeader("Content-Type", "application/json");
809
+ opts.csrfToken = csrfToken;
793
810
  req.send(JSON.stringify(opts));
794
811
  req.onreadystatechange = function() {
795
812
  if(req.readyState == 4) {
@@ -803,6 +820,28 @@
803
820
  return html.replace(/&/, "&amp;").replace(/</g, "&lt;");
804
821
  }
805
822
 
823
+ function hasConsoleBeenUsedPreviously() {
824
+ return !!document.cookie.split('; ').find(function(cookie) {
825
+ return cookie.startsWith('BetterErrors-has-used-console=');
826
+ });
827
+ }
828
+
829
+ var consoleHasBeenUsed = hasConsoleBeenUsedPreviously();
830
+
831
+ function consoleWasJustUsed() {
832
+ if (consoleHasBeenUsed) {
833
+ return;
834
+ }
835
+
836
+ hideConsoleHint();
837
+ consoleHasBeenUsed = true;
838
+ document.cookie = "BetterErrors-has-used-console=true;path=/;max-age=31536000;samesite"
839
+ }
840
+
841
+ function hideConsoleHint() {
842
+ document.querySelector('body').className += " console-has-been-used";
843
+ }
844
+
806
845
  function REPL(index) {
807
846
  this.index = index;
808
847
 
@@ -824,15 +863,20 @@
824
863
  this.inputElement = this.container.querySelector("input");
825
864
  this.outputElement = this.container.querySelector("pre");
826
865
 
866
+ if (consoleHasBeenUsed) {
867
+ hideConsoleHint();
868
+ }
869
+
827
870
  var self = this;
828
871
  this.inputElement.onkeydown = function(ev) {
829
872
  self.onKeyDown(ev);
873
+ consoleWasJustUsed();
830
874
  };
831
875
 
832
876
  this.setPrompt(">>");
833
877
 
834
878
  REPL.all[this.index] = this;
835
- }
879
+ };
836
880
 
837
881
  REPL.prototype.focus = function() {
838
882
  this.inputElement.focus();
@@ -1,7 +1,10 @@
1
1
  <%== text_heading("=", "%s at %s" % [exception_type, request_path]) %>
2
2
 
3
- > <%== exception_message %>
4
- <% if backtrace_frames.any? %>
3
+ <%== exception_message %>
4
+
5
+ > To access an interactive console with this error, point your browser to: /__better_errors
6
+
7
+ <% if backtrace_frames.any? -%>
5
8
 
6
9
  <%== text_heading("-", "%s, line %i" % [first_frame.pretty_path, first_frame.line]) %>
7
10
 
@@ -1,7 +1,14 @@
1
1
  <header class="trace_info clearfix">
2
2
  <div class="title">
3
3
  <h2 class="name"><%= @frame.name %></h2>
4
- <div class="location"><span class="filename"><a href="<%= editor_url(@frame) %>"><%= @frame.pretty_path %></a></span></div>
4
+ <div class="location">
5
+ <span class="filename">
6
+ <a
7
+ href="<%= editor_url(@frame) %>"
8
+ <%= ENV.key?('BETTER_ERRORS_INSIDE_FRAME') ? "target=_blank" : '' %>
9
+ ><%= @frame.pretty_path %></a>
10
+ </span>
11
+ </div>
5
12
  </div>
6
13
  <div class="code_block clearfix">
7
14
  <%== html_formatted_code_block @frame %>
@@ -18,7 +25,7 @@
18
25
  </header>
19
26
 
20
27
  <% if BetterErrors.binding_of_caller_available? && @frame.frame_binding %>
21
- <div class="hint">
28
+ <div class="hint live-console-hint">
22
29
  This is a live shell. Type in here.
23
30
  </div>
24
31
 
@@ -1,3 +1,3 @@
1
1
  module BetterErrors
2
- VERSION = "2.7.1"
2
+ VERSION = "2.9.0"
3
3
  end
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: 2.7.1
4
+ version: 2.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: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -146,8 +146,10 @@ extensions: []
146
146
  extra_rdoc_files: []
147
147
  files:
148
148
  - ".coveralls.yml"
149
+ - ".github/workflows/ci.yml"
150
+ - ".github/workflows/release.yml"
149
151
  - ".gitignore"
150
- - ".travis.yml"
152
+ - ".ruby-version"
151
153
  - ".yardopts"
152
154
  - CHANGELOG.md
153
155
  - Gemfile
@@ -178,8 +180,10 @@ files:
178
180
  - lib/better_errors/code_formatter.rb
179
181
  - lib/better_errors/code_formatter/html.rb
180
182
  - lib/better_errors/code_formatter/text.rb
183
+ - lib/better_errors/editor.rb
181
184
  - lib/better_errors/error_page.rb
182
185
  - lib/better_errors/exception_extension.rb
186
+ - lib/better_errors/exception_hint.rb
183
187
  - lib/better_errors/inspectable_value.rb
184
188
  - lib/better_errors/middleware.rb
185
189
  - lib/better_errors/rails.rb
@@ -214,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
218
  - !ruby/object:Gem::Version
215
219
  version: '0'
216
220
  requirements: []
217
- rubygems_version: 3.1.2
221
+ rubygems_version: 3.1.4
218
222
  signing_key:
219
223
  specification_version: 4
220
224
  summary: Better error page for Rails and other Rack apps
@@ -1,98 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- notifications:
4
- webhooks:
5
- # With COVERALLS_PARALLEL, coverage information sent to coveralls will not be processed until
6
- # this webhook is sent.
7
- # https://coveralls.zendesk.com/hc/en-us/articles/203484329-Parallel-Build-Webhook
8
- - secure: "YnHYbTq51ySistjvOxsuNhyg4GLuUffEJstTYeGYXiBF7HG5h43IVYo8KNuLzwkgsOYBcNo+YMdQX7qCqJffSbhsr1FZRSzBmjFFxcyD4hu+ukM2theZ4mePVAZiePscYvQPRNY4hIb4d3egStJEytkalDhB3sOebF57tIaCssg="
9
- rvm:
10
- - 2.2.10
11
- - 2.3.8
12
- - 2.4.9
13
- - 2.5.7
14
- - 2.6.5
15
- - 2.7.0
16
- - ruby-head
17
- gemfile:
18
- - gemfiles/rails42.gemfile
19
- - gemfiles/rails50.gemfile
20
- - gemfiles/rails51.gemfile
21
- - gemfiles/rails52.gemfile
22
- - gemfiles/rails60.gemfile
23
- - gemfiles/rails42_haml.gemfile
24
- - gemfiles/rails50_haml.gemfile
25
- - gemfiles/rails51_haml.gemfile
26
- - gemfiles/rails52_haml.gemfile
27
- - gemfiles/rails60_haml.gemfile
28
- - gemfiles/rails42_boc.gemfile
29
- - gemfiles/rails50_boc.gemfile
30
- - gemfiles/rails51_boc.gemfile
31
- - gemfiles/rails52_boc.gemfile
32
- - gemfiles/rails60_boc.gemfile
33
- - gemfiles/rack.gemfile
34
- - gemfiles/rack_boc.gemfile
35
- - gemfiles/pry09.gemfile
36
- - gemfiles/pry010.gemfile
37
- - gemfiles/pry011.gemfile
38
- matrix:
39
- fast_finish: true
40
- allow_failures:
41
- - rvm: ruby-head
42
- - gemfile: gemfiles/pry010.gemfile
43
- - gemfile: gemfiles/pry011.gemfile
44
- exclude:
45
- - rvm: 2.2.10
46
- gemfile: gemfiles/rails60.gemfile
47
- - rvm: 2.2.10
48
- gemfile: gemfiles/rails60_boc.gemfile
49
- - rvm: 2.2.10
50
- gemfile: gemfiles/rails60_haml.gemfile
51
- - rvm: 2.3.8
52
- gemfile: gemfiles/rails42.gemfile
53
- - rvm: 2.3.8
54
- gemfile: gemfiles/rails42_boc.gemfile
55
- - rvm: 2.3.8
56
- gemfile: gemfiles/rails42_haml.gemfile
57
- - rvm: 2.3.8
58
- gemfile: gemfiles/rails60.gemfile
59
- - rvm: 2.3.8
60
- gemfile: gemfiles/rails60_boc.gemfile
61
- - rvm: 2.3.8
62
- gemfile: gemfiles/rails60_haml.gemfile
63
- - rvm: 2.4.9
64
- gemfile: gemfiles/rails42.gemfile
65
- - rvm: 2.4.9
66
- gemfile: gemfiles/rails42_boc.gemfile
67
- - rvm: 2.4.9
68
- gemfile: gemfiles/rails42_haml.gemfile
69
- - rvm: 2.4.9
70
- gemfile: gemfiles/rails60.gemfile
71
- - rvm: 2.4.9
72
- gemfile: gemfiles/rails60_boc.gemfile
73
- - rvm: 2.4.9
74
- gemfile: gemfiles/rails60_haml.gemfile
75
- - rvm: 2.5.7
76
- gemfile: gemfiles/rails42.gemfile
77
- - rvm: 2.5.7
78
- gemfile: gemfiles/rails42_boc.gemfile
79
- - rvm: 2.5.7
80
- gemfile: gemfiles/rails42_haml.gemfile
81
- - rvm: 2.6.5
82
- gemfile: gemfiles/rails42.gemfile
83
- - rvm: 2.6.5
84
- gemfile: gemfiles/rails42_boc.gemfile
85
- - rvm: 2.6.5
86
- gemfile: gemfiles/rails42_haml.gemfile
87
- - rvm: 2.7.0
88
- gemfile: gemfiles/rails42.gemfile
89
- - rvm: 2.7.0
90
- gemfile: gemfiles/rails42_boc.gemfile
91
- - rvm: 2.7.0
92
- gemfile: gemfiles/rails42_haml.gemfile
93
- - rvm: ruby-head
94
- gemfile: gemfiles/rails42.gemfile
95
- - rvm: ruby-head
96
- gemfile: gemfiles/rails42_boc.gemfile
97
- - rvm: ruby-head
98
- gemfile: gemfiles/rails42_haml.gemfile