json_apiable 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_apiable/json_apiable.rb +1 -1
- data/lib/json_apiable/renderers.rb +5 -0
- data/lib/json_apiable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8badac374f5beeb1a450a13c9e15a9b51ecf3f7999a1584037df80234746365e
|
4
|
+
data.tar.gz: 9731a6810c7bde962dfd7ff5874f18366b6bb378a7a0e4358200249ef12f569b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0a1e8c16896ba6bb97165654a6fa31d2565eb2ae03a9a1fb464ee44f62cbf73b9556fc1f68366b2b3a54665bcd2ad66e84c7947200efe345a3de185f3259a60
|
7
|
+
data.tar.gz: 31e1bc0ce9505acc7234cc6dc0f1866ee1f7aa99411acedac3bff8db8d74360fa256b6e3fa11c969f2c8b6bb68f352604b5419f6b4c980fbe727975de63d48d4
|
@@ -20,7 +20,7 @@ module JsonApiable
|
|
20
20
|
|
21
21
|
rescue_from ArgumentError, with: :respond_to_bad_argument
|
22
22
|
rescue_from ActionController::UnpermittedParameters, with: :respond_to_bad_argument
|
23
|
-
rescue_from JSONAPI::Serializer::UnsupportedIncludeError, with: :
|
23
|
+
rescue_from JSONAPI::Serializer::UnsupportedIncludeError, with: :respond_to_exception_raised
|
24
24
|
rescue_from MalformedRequestError, with: :respond_to_malformed_request
|
25
25
|
rescue_from UnprocessableEntityError, with: :respond_to_unprocessable_entity
|
26
26
|
rescue_from UnauthorizedError, with: :respond_to_unauthorized
|
@@ -32,6 +32,11 @@ module JsonApiable
|
|
32
32
|
json_render_errors json: errors, status: :bad_request
|
33
33
|
end
|
34
34
|
|
35
|
+
def respond_to_exception_raised(err_msg)
|
36
|
+
errors = [{ title: 'Invalid Argument', detail: err_msg.message }]
|
37
|
+
json_render_errors json: errors, status: :bad_request
|
38
|
+
end
|
39
|
+
|
35
40
|
def respond_to_malformed_request(err_msg = nil)
|
36
41
|
errors = [{ title: 'Malformed Request', detail: err_msg.to_s }]
|
37
42
|
json_render_errors json: errors, status: :bad_request
|
data/lib/json_apiable/version.rb
CHANGED