moromi-error 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/moromi/error/{_default.html.erb → default.html.erb} +0 -0
- data/app/views/moromi/error/{_default.html.slim → default.html.slim} +0 -0
- data/app/views/moromi/error/{_default.json.jb → default.json.jb} +0 -0
- data/app/views/moromi/error/{_default.json.jbuilder → default.json.jbuilder} +0 -0
- data/lib/moromi/error/renderer.rb +6 -4
- data/lib/moromi/error/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b587a5b916270e9fc2f606b34cd1a1079935b3b767ad268c3c912a2ad7c11e7
|
4
|
+
data.tar.gz: 598fa10b9299e177b7853d87a4ee73c11a6afe6ad122eb737de3ee75aa1a6408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80cef3e80a2a47ff15b94c05486828096b29084ed54511cc534b93698578a603da8bb97b14054cef04443f02fccb49013bf439b7d6be0ebc615ce3b7d6a78c87
|
7
|
+
data.tar.gz: e687c1014bbd4f4b7e55ec2cdbc26c382b6004d8ced4f4a386842faa85b03e1efafc11a738b9e8de99862b4a8b45711e1259036ece9d7c206173804667383f25
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -8,10 +8,12 @@ module Moromi::Error
|
|
8
8
|
}.freeze
|
9
9
|
|
10
10
|
included do
|
11
|
+
class_attribute :default_moromi_error_template_path
|
11
12
|
class_attribute :default_moromi_error_renderer_options
|
12
13
|
class_attribute :moromi_error_logger
|
13
14
|
|
14
|
-
self.
|
15
|
+
self.default_moromi_error_template_path = ERROR_TEMPLATES[:default]
|
16
|
+
self.default_moromi_error_renderer_options = {layout: false}
|
15
17
|
self.moromi_error_logger = Moromi::Error::DefaultLogger.new
|
16
18
|
end
|
17
19
|
|
@@ -44,7 +46,6 @@ module Moromi::Error
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def render_force_update(exception: Moromi::Error::NeedForceUpdate.new, options: nil, locals: {})
|
47
|
-
options = options || {partial: ERROR_TEMPLATES[:default], layout: false}
|
48
49
|
render_bad_request(exception: exception, options: options, locals: locals)
|
49
50
|
end
|
50
51
|
|
@@ -58,7 +59,8 @@ module Moromi::Error
|
|
58
59
|
|
59
60
|
private
|
60
61
|
|
61
|
-
def render_error(status, title, exception, options: nil, locals: {})
|
62
|
+
def render_error(status, title, exception, options: nil, template_path: nil, locals: {})
|
63
|
+
template_path ||= self.class::default_moromi_error_template_path
|
62
64
|
options = options || self.class::default_moromi_error_renderer_options
|
63
65
|
e = Moromi::Error::Default.make(exception)
|
64
66
|
|
@@ -68,7 +70,7 @@ module Moromi::Error
|
|
68
70
|
locals = {status: status, title: title, exception: e}.merge(locals)
|
69
71
|
|
70
72
|
render_block = -> {
|
71
|
-
render options
|
73
|
+
render template_path, **options, locals: locals
|
72
74
|
}
|
73
75
|
|
74
76
|
respond_to do |format|
|
data/lib/moromi/error/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moromi-error
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -128,10 +128,10 @@ files:
|
|
128
128
|
- LICENSE
|
129
129
|
- README.md
|
130
130
|
- Rakefile
|
131
|
-
- app/views/moromi/error/
|
132
|
-
- app/views/moromi/error/
|
133
|
-
- app/views/moromi/error/
|
134
|
-
- app/views/moromi/error/
|
131
|
+
- app/views/moromi/error/default.html.erb
|
132
|
+
- app/views/moromi/error/default.html.slim
|
133
|
+
- app/views/moromi/error/default.json.jb
|
134
|
+
- app/views/moromi/error/default.json.jbuilder
|
135
135
|
- bin/rails
|
136
136
|
- config/locales/moromi-error.yml
|
137
137
|
- lib/generators/moromi/error/views_generator.rb
|