shift-api-core 0.1.0 → 0.2.0
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/lib/shift/api/core/errors.rb +22 -1
- data/lib/shift/api/core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b022dd6e6d950420939404cd6ef300295ec4ad61
|
4
|
+
data.tar.gz: 5e0a941c399794b4b0aa05fd6a57bd44377b6637
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b497e47447d49dfc883182ee10f74fba115d9eedbc78337315c8d961726f8820502ee89bcbeaa3f434bef691a9b245da4f345584e2065b6cbcbd5165936a96f0
|
7
|
+
data.tar.gz: bba9a4d6edbc29c879cb3b71f86e024f65619b1ef8bc102f6878bd633a6a0027ea3f2f74b9934b38d316090d717061829d3193bc9e6d05c05ba07e4abcb4f469
|
@@ -29,8 +29,29 @@ module Shift
|
|
29
29
|
end
|
30
30
|
|
31
31
|
class ServerError < ApiError
|
32
|
+
# Replace message with more useful error from the API
|
32
33
|
def message
|
33
|
-
"Internal
|
34
|
+
default_message = "Internal Server Error"
|
35
|
+
|
36
|
+
api_errors = env.response.body["errors"]
|
37
|
+
return default_message if api_errors.nil?
|
38
|
+
|
39
|
+
api_exception = api_errors[0].dig("meta", "exception")
|
40
|
+
api_exception ? api_exception : default_message
|
41
|
+
end
|
42
|
+
|
43
|
+
# Prepend API backtrace to the backtrace from the gem
|
44
|
+
def backtrace
|
45
|
+
original_backtrace = super
|
46
|
+
return nil if original_backtrace.nil?
|
47
|
+
|
48
|
+
api_errors = env.response.body["errors"]
|
49
|
+
return original_backtrace if api_errors.nil?
|
50
|
+
|
51
|
+
api_backtrace = api_errors[0].dig("meta", "backtrace")
|
52
|
+
return original_backtrace if api_backtrace.nil?
|
53
|
+
|
54
|
+
api_backtrace.map { |entry| "/<shift_api>#{entry}" }.concat(original_backtrace)
|
34
55
|
end
|
35
56
|
end
|
36
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shift-api-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shift Commerce Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.6.
|
147
|
+
rubygems_version: 2.6.8
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Core gem for all shift commerce API gems
|