hal_api-rails 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hal_api/controller/exceptions.rb +6 -5
- data/lib/hal_api/errors.rb +8 -0
- data/lib/hal_api/rails/version.rb +1 -1
- data/lib/hal_api/representer/embeds.rb +3 -0
- 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: 93692b389012f8d919478bd871f756f90118c517a1edde2a5ae6cbb463d644b1
|
4
|
+
data.tar.gz: b15713d0ba0c1e005044dc48cc0a737066d89e1de84f1233e8072e17cdabc6d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 572d57798b5240e8e33032de9b74492548f4901bb3fc74e9f2c40b65c59fea32d59b51a958e62087609365302ceb6fc349532920fb779a9d3d35aab841e97be5
|
7
|
+
data.tar.gz: 8f2e81fe36e137287dab3492dc0636588c06ba3910fe9ddb682e3bfe42ddede2c4e79717229f12a6af8174bbde2fcf1cb222fbdc5aaadc1d64807f0c12e7e175
|
@@ -25,11 +25,12 @@ module HalApi::Controller::Exceptions
|
|
25
25
|
|
26
26
|
notice_error(exception) if error.status >= 500
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
respond_with(
|
29
|
+
error,
|
30
|
+
status: error.status,
|
31
|
+
location: nil, # for POST requests
|
32
|
+
represent_with: HalApi::Errors::Representer
|
33
|
+
)
|
33
34
|
end
|
34
35
|
|
35
36
|
def log_error(env, wrapper)
|
data/lib/hal_api/errors.rb
CHANGED
@@ -48,4 +48,12 @@ module HalApi::Errors
|
|
48
48
|
super(msg, 400, hint)
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
module Representer
|
53
|
+
include Roar::JSON::HAL
|
54
|
+
|
55
|
+
property :status
|
56
|
+
property :message
|
57
|
+
property :backtrace, if: -> (*) { Rails.configuration.try(:consider_all_requests_local) }
|
58
|
+
end
|
51
59
|
end
|