sitepress-server 3.1.4 → 3.2.1

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: 18596923541141f76f1965a039fce7305b4fa4d2c5c9e5f2bb8e0df04c4da594
4
- data.tar.gz: 34fb27d144cfe4f257f5eaa679de2ad201c53b3c83c8ff81427dea12636473f1
3
+ metadata.gz: 8bbd5935814e243c594d88c8fc30c4af990d113b5cde6295f0266b0991db8145
4
+ data.tar.gz: 9c48864666c0a6472e7c4ea53ed0174ada5680961e60035d94443bda1e7591dc
5
5
  SHA512:
6
- metadata.gz: 381c176c181e94085dd4d14fdab1df991807cde702bad301c5db53064018adfc15ca529085782388947c45e44def35c2b952ea5735885394db2aed47c3d24024
7
- data.tar.gz: e341b6aac2c6be8b3a8743e2a54f491f822ac03bfe50dec37092bace6c41e64236a66410ee73dcf2346c6296dfd506a580546681f8621dd8bc28082d03fae207
6
+ metadata.gz: 2676271389e1fc4b98477702794405bedf90b97a82f9c00e9691b818a64b6f0d698c406a9512559c969c1f7500b7091fda5a0da435f3428297bc277ff1cf6545
7
+ data.tar.gz: 95ffecabbb21ef937e2f2efadc0a12e319985233e99e6087bdca6d365cf73d06832025afc4fa5e484834c18754b242959a00c4325f1e2294fff83eaf501b9a8a
@@ -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.1.4
4
+ version: 3.2.1
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-10-04 00:00:00.000000000 Z
11
+ date: 2023-01-04 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.1.4
33
+ version: 3.2.1
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.1.4
40
+ version: 3.2.1
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.20
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.