sitepress-server 3.2.0 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d21bc809e8c9477e4d718f81fee3edb8ad17f64062594b430368c0c27f3d6446
4
- data.tar.gz: 4689474b3f41ef939d2cda8d8b5445b66fbfae865bf1d222c5af27fbe750f71d
3
+ metadata.gz: f32867218564e6988ff1c759198683e3d020452f882643bcaee2282dad218c0c
4
+ data.tar.gz: 72dde5b9f260eb620d9a89d31a9e751ba796c18f4dd2a62f388eb3922fd43ebb
5
5
  SHA512:
6
- metadata.gz: c77f01daded171aaf9e442493fff55861bf26b8cb2e992915ddb73421b74fe724d1ddc86304c08fe703f59962cbe45e7922dc1a9561e199b812ecb20422acda9
7
- data.tar.gz: 52f27821066f30ae435470ca211010ae486d2a29bea7a4e2966fb30960d1f27bc61e6df6466ad3a4a275df1744b864f6a8ddec7c6a9b936199b8c6764590b050
6
+ metadata.gz: 422f5cd01f6a693b9959ab34b2776285ea7d672674cf45a164b0285db5387e5367ed9aefc1c689439318a1cefacab7d8f26c2c970e8bfd61f21367fedfcbb492
7
+ data.tar.gz: 974d7c6afb7e0b5a714ac8844ffd1ddea86340bde172960406d591ef73d065004bb27d3b41bce840723efeec2e178256091cbe0fd86c8ced398862374299f19c
@@ -6,7 +6,8 @@ class SiteController < ApplicationController
6
6
  # This `rescue_from` order is important; it must come before the
7
7
  # `include Sitepress::SitePages` statement; otherwise exceptions
8
8
  # won't be properly handled.
9
- rescue_from Exception, with: :sitepress_error
9
+ rescue_from Exception, with: :standard_error
10
+ rescue_from ActionView::Template::Error, with: :action_view_template_error
10
11
  rescue_from Sitepress::ResourceNotFoundError, with: :page_not_found
11
12
 
12
13
  layout :site_layout
@@ -16,12 +17,20 @@ class SiteController < ApplicationController
16
17
  DEFAULT_SITE_LAYOUT if template_exists? DEFAULT_SITE_LAYOUT
17
18
  end
18
19
 
19
- def sitepress_error(exception)
20
+ def standard_error(exception)
21
+ render_exception(template: "standard_error", exception: exception)
22
+ end
23
+
24
+ def action_view_template_error(exception)
25
+ render_exception(template: "action_template_error", exception: exception)
26
+ end
27
+
28
+ def render_exception(template:, exception:)
20
29
  raise exception unless has_error_reporting_enabled?
21
30
 
22
31
  @title = "Error in resource #{current_page.asset.path}".html_safe
23
32
  @exception = exception
24
- render "error", layout: "sitepress", status: :internal_server_error
33
+ render template, layout: "sitepress", status: :internal_server_error
25
34
  end
26
35
 
27
36
  def page_not_found(exception)
@@ -0,0 +1,29 @@
1
+ <h2><%= @exception.class %>: <%= @exception.message %> in <%= current_page.asset.path %></h2>
2
+ <h3>Source</h3>
3
+
4
+ <code>
5
+ <pre><%= current_page.asset.path %></pre>
6
+ </code>
7
+
8
+ <h3>Backtrace</h3>
9
+ <code>
10
+ <pre><%= @exception.backtrace.join("\n") %></pre>
11
+ </code>
12
+
13
+ <h3>Resources</h3>
14
+ <table>
15
+ <thead>
16
+ <th>Request path</th>
17
+ <th>Asset path</th>
18
+ <th>Media type</th>
19
+ </thead>
20
+ <tbody>
21
+ <% site.resources.each do |resource| %>
22
+ <tr>
23
+ <td><%= link_to resource.request_path, resource.request_path %></td>
24
+ <td><%= resource.asset.path %></td>
25
+ <td><%= resource.asset.mime_type %></td>
26
+ </tr>
27
+ <% end %>
28
+ </tbody>
29
+ </table>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitepress-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-05 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack-test
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.0
33
+ version: 3.2.2
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
- version: 3.2.0
40
+ version: 3.2.2
41
41
  description:
42
42
  email:
43
43
  - bradgessler@gmail.com
@@ -53,8 +53,9 @@ files:
53
53
  - rails/app/controllers/site_controller.rb
54
54
  - rails/app/helpers/application_helper.rb
55
55
  - rails/app/views/layouts/sitepress.html.erb
56
- - rails/app/views/site/error.html.erb
56
+ - rails/app/views/site/action_template_error.html.erb
57
57
  - rails/app/views/site/not_found.html.erb
58
+ - rails/app/views/site/standard_error.html.erb
58
59
  - rails/public/_sitepress/images/logo.svg
59
60
  - rails/public/_sitepress/stylesheets/site.css
60
61
  - sitepress-server.gemspec
@@ -80,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  - !ruby/object:Gem::Version
81
82
  version: '0'
82
83
  requirements: []
83
- rubygems_version: 3.3.7
84
+ rubygems_version: 3.4.1
84
85
  signing_key:
85
86
  specification_version: 4
86
87
  summary: Sitepress rack app for stand-alone of embedded usage.