rackr 0.0.51 → 0.0.53

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5349fb78d9228c927c1a13e4870dbe7797ed9dd9f2c6e6868c48ea21cb6a30d1
4
- data.tar.gz: e343559e578fff15af1d85254d315f6999ca119fc9452899cc0b0d04835638be
3
+ metadata.gz: 207a61eead2347b17a9f17c396934954640a8658ebede9625ad62e05e2db9465
4
+ data.tar.gz: e8e7c162619f150483c1c1000f4cfff16a65cc68596871d9f034c9d6fcdf5e1a
5
5
  SHA512:
6
- metadata.gz: 2485768ddeba8f7460bc3d1cef02e3b931f0d3ff611d2418601298e73c62d114e8c9fb559f1e75dbd3788c8a64b3cb170c6a1d8118aec0246c03bcc818a5f89d
7
- data.tar.gz: 55a73f398a954e32c9c4b83f3ff131ce57b80ac1da445c199d32a413f47ab877ebbdba5b70e3a06d1cb7cf90ff4280cb7db59d6fbaefdcb5843cdb0727e3187e
6
+ metadata.gz: 9b5c019b83ffd983b74a35b07588d190f64c1ac01e1c7efffd9cc5595d5901f653878c5ad3ba2496b4557841d12a0886cdab68d9eda262604290a73345474c00
7
+ data.tar.gz: c3b6d38fa59027763530fe14f1e4630fe78de3aa568c7e998d93725e06bb3f30308be706fa26f5c30cf2fe5d32c568065f39617dd1db4d4a7222d9558a6068a6
@@ -9,37 +9,34 @@ class Rackr
9
9
  html do
10
10
  tag :head do
11
11
  title 'Application error'
12
- tag :style, %q(
13
- body {
14
- margin: 0 auto;
15
- width: 98.5%;
16
- font-size: 1.1em;
17
- background-color: #666666;
18
- font-family: monospace;
19
- margin-top: 1em;
20
- }
21
- p {
22
- background-color: #000000;
23
- padding: 1em;
24
- font-size: 1.3em;
25
- }
26
- div {
27
- background-color: #191919;
28
- color: white;
29
- padding: 0em 2em;
30
- border: 5px solid #ffffff;
31
- border-radius: 1em;
32
- }
33
- h1 {
34
- background-color: #464646;
35
- padding: 1em;
36
- border-radius: 0.2em;
37
- }
38
- )
12
+ _ %q(<style>
13
+ html * { padding:0; margin:0; }
14
+ body * { padding:10px 20px; }
15
+ body * * { padding:0; }
16
+ body { font:small sans-serif; }
17
+ body>div { border-bottom:1px solid #ddd; }
18
+ h1 { font-weight:normal; }
19
+ h2 { margin-bottom:.8em; }
20
+ h2 span { font-size:80%; color:#666; font-weight:normal; }
21
+ #summary { background: #ffc; }
22
+ #summary h2 { font-weight: normal; color: #666; }
23
+ pre {
24
+ background: #f8f8f8;
25
+ padding: 1em;
26
+ margin-bottom: 1em;
27
+ }
28
+ </style>)
39
29
  end
40
30
  tag :body do
41
- div do
42
- h1 env['error'].inspect
31
+ div id: 'summary' do
32
+ h1 env['error'].class.to_s
33
+ if env['error'].message.size > 1000
34
+ h2 "#{env['error'].message.slice(0, 1000)} ..."
35
+ else
36
+ h2 env['error'].message
37
+ end
38
+ end
39
+ div id: 'backtrace' do
43
40
  backtrace(env)
44
41
  end
45
42
  end
@@ -48,8 +45,13 @@ class Rackr
48
45
 
49
46
  def backtrace(env)
50
47
  first, *tail = env['error'].backtrace
48
+ h2 do
49
+ _ 'Traceback '
50
+ span '(innermost first)'
51
+ end
51
52
 
52
53
  tag :p, first, class: "first-p"
54
+ br
53
55
 
54
56
  line_number = extract_line_number(first)
55
57
  match = first.match(%r{^(\/[\w\/.-]+)})
@@ -64,10 +66,9 @@ class Rackr
64
66
  "#{i+1}: #{line} \n"
65
67
  end
66
68
 
67
- tag :pre, slice_around_index(lines, line_number).join("")
69
+ tag :pre, slice_around_index(lines, line_number).join("").chomp
68
70
  end
69
71
 
70
- hr
71
72
  tag :p, tail.join("\n")
72
73
  end
73
74
 
data/lib/rackr/router.rb CHANGED
@@ -72,7 +72,7 @@ class Rackr
72
72
  rescue Rackr::NotFound
73
73
  call_endpoint(@not_found, request_builder.call)
74
74
  rescue Exception => e
75
- return @error.call(request_builder.call, e) unless @dev_mode
75
+ return @error.call(request_builder.call, e) if !@dev_mode || ENV['RACKR_ERROR_DEV']
76
76
 
77
77
  call_endpoint(Errors::DevHtml, env.merge({'error' => e}))
78
78
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rackr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.51
4
+ version: 0.0.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique F. Teixeira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-03 00:00:00.000000000 Z
11
+ date: 2025-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubi