eco-helpers 2.1.9 → 2.1.11
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 +14 -1
- data/lib/eco/api/error.rb +0 -2
- data/lib/eco/api/session/batch/errors.rb +20 -11
- data/lib/eco/api/session/batch/job.rb +0 -1
- data/lib/eco/api/usecases/default_cases/set_supervisor_case.rb +3 -9
- data/lib/eco/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: fe9a800859ad998e9d89ef67bf62bf00f9a300f05ff8ebf7491be210d1d5056e
|
4
|
+
data.tar.gz: 37ca33fede2bd9f642da312ff5bcbbac20b583509d09b3418357dd47e6b52d06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289fed1d974aee2a906ccf6d5dbee843da583e0a5ba1ff4a85df180057c5f42477ffb60b280cd20ad09d7efb0994017d60685cf05cd402b3a5835bbedabe8e38
|
7
|
+
data.tar.gz: 26d36e3d9647f1f35168375383eece7694ca0829a2550118ee3f22d793f1ea21886e7232f2532b35329ba5b12d19754290676ee200f13d6f9407a2f3596d1668
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.1.
|
4
|
+
## [2.1.12] - 2022-11-xx
|
5
5
|
|
6
6
|
### Added
|
7
7
|
### Changed
|
8
8
|
### Fixed
|
9
9
|
|
10
|
+
## [2.1.11] - 2022-11-30
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- Bring the `-set-supervisor` native case up to date
|
14
|
+
- `Eco::API::Session::Batch::Errors#errors`
|
15
|
+
- better error catching and description
|
16
|
+
|
17
|
+
## [2.1.10] - 2022-11-30
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
- `Eco::API::Session::Batch::Errors#errors`
|
21
|
+
- include errors with no `error` property in body (i.e. `!response.success?`)
|
22
|
+
|
10
23
|
## [2.1.9] - 2022-11-29
|
11
24
|
|
12
25
|
### Changed
|
data/lib/eco/api/error.rb
CHANGED
@@ -76,7 +76,6 @@ module Eco
|
|
76
76
|
@str_err = "Unknown details field."
|
77
77
|
@match = /details \> (.+?) is an unknown field/
|
78
78
|
end
|
79
|
-
|
80
79
|
end
|
81
80
|
|
82
81
|
class << self
|
@@ -135,7 +134,6 @@ module Eco
|
|
135
134
|
@err_msg = err_msg
|
136
135
|
@session = session
|
137
136
|
@entry = entry
|
138
|
-
|
139
137
|
super(built_error)
|
140
138
|
end
|
141
139
|
|
@@ -81,19 +81,29 @@ module Eco
|
|
81
81
|
# 3. `entry` -> the entry that generated the error
|
82
82
|
# 4. `response` -> the original response from the server that carries the error
|
83
83
|
def errors
|
84
|
+
require 'byebug'
|
84
85
|
entries.each_with_object([]) do |entry, arr|
|
85
86
|
response = status[entry]
|
86
87
|
if body = response.body
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
klass.new(err_msg: msg, entry: entry, session: session),
|
93
|
-
entry,
|
94
|
-
response
|
95
|
-
))
|
88
|
+
errs = []
|
89
|
+
case body
|
90
|
+
when Hash
|
91
|
+
if errs = (body["errors"] || body["error"])
|
92
|
+
errs = [errs].flatten(1).compact
|
96
93
|
end
|
94
|
+
if errs.empty? && !response.success?
|
95
|
+
errs = [body["response"]].flatten(1).compact
|
96
|
+
end
|
97
|
+
when String
|
98
|
+
errs = [body]
|
99
|
+
end
|
100
|
+
errs.each do |msg|
|
101
|
+
arr.push(ErrorCache.new(
|
102
|
+
klass = Eco::API::Error.get_type(msg),
|
103
|
+
klass.new(err_msg: msg, entry: entry, session: session),
|
104
|
+
entry,
|
105
|
+
response
|
106
|
+
))
|
97
107
|
end
|
98
108
|
end
|
99
109
|
end
|
@@ -174,7 +184,7 @@ module Eco
|
|
174
184
|
i = to_index(key)
|
175
185
|
entry = queue.to_a[i]
|
176
186
|
response = status[i]
|
177
|
-
msg = "Error #{response.status}: #{response.body}\n"
|
187
|
+
msg = "Error #{response.status} (#{response.status.reason}): #{response.body}\n"
|
178
188
|
msg += "-- Failed to batch #{method}. Person: #{person_ref(entry)}"
|
179
189
|
end
|
180
190
|
msg
|
@@ -185,7 +195,6 @@ module Eco
|
|
185
195
|
logger.error(str(key))
|
186
196
|
end
|
187
197
|
end
|
188
|
-
|
189
198
|
end
|
190
199
|
end
|
191
200
|
end
|
@@ -7,17 +7,11 @@ class Eco::API::UseCases::DefaultCases::SetSupervisorCase < Eco::API::Common::Lo
|
|
7
7
|
update = session.new_job("main", "update", :update, usecase)
|
8
8
|
|
9
9
|
micro.with_each_present(entries, people, options, log_starter: true) do |entry, person|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
person.supervisor_id = supervisor.id unless options.dig(:exclude, :supervisor)
|
14
|
-
else
|
15
|
-
unless !entry.supervisor_id
|
16
|
-
session.logger.warn("Supervisor '#{entry.supervisor_id}' does not exist. Entry: #{entry.to_s(:identify)}")
|
17
|
-
end
|
10
|
+
if entry.supervisor_id?
|
11
|
+
micro.set_supervisor(person, entry.supervisor_id, people, options) do |unknown_id|
|
12
|
+
session.logger.warn("Supervisor '#{entry.supervisor_id}' does not exist. Entry: #{entry.to_s(:identify)}")
|
18
13
|
end
|
19
14
|
end
|
20
15
|
end
|
21
16
|
end
|
22
|
-
|
23
17
|
end
|
data/lib/eco/version.rb
CHANGED