agilibox 1.9.1 → 1.9.3
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/app/controllers/concerns/agilibox/back_url_concern.rb +1 -1
- data/lib/agilibox/active_model_custom_error_messages.rb +1 -1
- data/lib/agilibox/active_model_type_cast.rb +4 -4
- data/lib/agilibox/errors_middleware.rb +19 -9
- data/lib/agilibox/form_back_url.rb +1 -1
- data/lib/agilibox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 43edc1602674c41d34d28ab05565875acdcd8205875be814b807e8d6030fd606
|
|
4
|
+
data.tar.gz: 91c4ffe2a7a61e7b49ed725259bc458b3b1d2ae0777c1dfd51020152957f568d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd7b588581d44d6f0b46be007712bd3cdffd8bd6bdc4d1e4435248b3b6424c892dd57cea9ea8192a3a1d9dec2dffcb706ce0f86f94f2a1a272010e5333dbbe35
|
|
7
|
+
data.tar.gz: 7dd38de913db48ff9e96781889debf3024d7e1e6e33dd4ffced130963acfea2266c9a87818e10b988c89e8182be42db50d8539990c03c16cba6942429c092b06
|
data/CHANGELOG.md
CHANGED
|
@@ -46,7 +46,7 @@ module Agilibox::ActiveModelTypeCast
|
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
ActiveModel::Type::Date.
|
|
50
|
-
ActiveModel::Type::Boolean.
|
|
51
|
-
ActiveModel::Type::Decimal.
|
|
52
|
-
ActiveModel::Type::Float.
|
|
49
|
+
ActiveModel::Type::Date.prepend(Agilibox::ActiveModelTypeCast::Date)
|
|
50
|
+
ActiveModel::Type::Boolean.prepend(Agilibox::ActiveModelTypeCast::Boolean)
|
|
51
|
+
ActiveModel::Type::Decimal.prepend(Agilibox::ActiveModelTypeCast::Decimal)
|
|
52
|
+
ActiveModel::Type::Float.prepend(Agilibox::ActiveModelTypeCast::Decimal)
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
class Agilibox::ErrorsMiddleware
|
|
2
2
|
MAINTENANCE_ERRORS = [
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
"ActiveRecord::ConnectionTimeoutError",
|
|
4
|
+
"connections on port 5432",
|
|
5
|
+
"PG::UnableToSend",
|
|
5
6
|
]
|
|
6
7
|
|
|
7
8
|
NOT_ACCEPTABLE_ERRORS = [
|
|
8
|
-
ActionController::
|
|
9
|
-
ActionController::
|
|
10
|
-
|
|
9
|
+
"ActionController::BadRequest",
|
|
10
|
+
"ActionController::UnknownFormat",
|
|
11
|
+
"ActionController::UnknownHttpMethod",
|
|
12
|
+
"ActionView::MissingTemplate",
|
|
11
13
|
]
|
|
12
14
|
|
|
13
15
|
def initialize(app)
|
|
@@ -16,10 +18,18 @@ class Agilibox::ErrorsMiddleware
|
|
|
16
18
|
|
|
17
19
|
def call(env)
|
|
18
20
|
@app.call(env)
|
|
19
|
-
rescue
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
rescue StandardError => e
|
|
22
|
+
error = "#{e.class} : #{e.message}"
|
|
23
|
+
|
|
24
|
+
if MAINTENANCE_ERRORS.any? { |pattern| error.match?(pattern) }
|
|
25
|
+
return respond_with 503, "Maintenance en cours."
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if NOT_ACCEPTABLE_ERRORS.any? { |pattern| error.match?(pattern) }
|
|
29
|
+
return respond_with 406, "Not acceptable."
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
raise e
|
|
23
33
|
end
|
|
24
34
|
|
|
25
35
|
private
|
data/lib/agilibox/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: agilibox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- agilidée
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-01-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails-i18n
|