shift-api-core 0.3.1 → 0.4.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 +9 -4
- data/lib/shift/api/core/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: '02480b0039e54bd391537d9944d2d9b2318e7026d63a46d23504671443f8c57e'
|
4
|
+
data.tar.gz: a242e65bcb3294a46b22bbba81dea3f4743d37d16d21b92403b445dd1545fe47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78bbdd3c63a8fd364fe9da187293ebf300ed42b09aebf12770e03be491e0d61afc4b95ae630a44e2b50a92e8a38022722b87a022ac8fd471f7bf6cdfda06d7d6
|
7
|
+
data.tar.gz: fa22be8969a47f3ed231b83023e84e49c44a30936915bf413737e5a7eb973b7ec890818798ee2ba94d5239a638d4a06fb3eb936efe5323293c83b21354846a10
|
@@ -6,13 +6,15 @@ module Shift
|
|
6
6
|
# world in case we ever migrate from it.
|
7
7
|
module Errors
|
8
8
|
class ApiError < StandardError
|
9
|
-
attr_reader :env
|
10
|
-
|
9
|
+
attr_reader :env, :original_exception
|
10
|
+
|
11
|
+
def initialize(env, original_exception)
|
11
12
|
@env = env
|
13
|
+
@original_exception = original_exception
|
12
14
|
end
|
13
15
|
|
14
16
|
def self.from_jsonapi_client(ex)
|
15
|
-
new(ex.env)
|
17
|
+
new(ex.env, ex)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
@@ -34,7 +36,7 @@ module Shift
|
|
34
36
|
class ServerError < ApiError
|
35
37
|
# Replace message with more useful error from the API
|
36
38
|
def message
|
37
|
-
default_message = "Internal Server Error"
|
39
|
+
default_message = "Internal Server Error\n#{env.response.body}"
|
38
40
|
|
39
41
|
api_errors = env.response.body["errors"]
|
40
42
|
return default_message if api_errors.nil?
|
@@ -57,6 +59,9 @@ module Shift
|
|
57
59
|
api_backtrace.map { |entry| "/<shift_api>#{entry}" }.concat(original_backtrace)
|
58
60
|
end
|
59
61
|
end
|
62
|
+
|
63
|
+
class InternalServerError < ServerError
|
64
|
+
end
|
60
65
|
|
61
66
|
class Conflict < ServerError
|
62
67
|
def message
|
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.4.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: 2021-10-
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|