proc 0.13.0 → 0.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a554218f2f2a9cfe6bfa2e6f87ebf17abba0090e840d640ac5646c81b1d84c7c
4
- data.tar.gz: cfdd2fab893016a3fb2a1a76995ee611c28cca6ea051024fae03157c22d440d9
3
+ metadata.gz: 4fd5089ba0458dc13c198de1322bfc510a54157ef0ec49f957efa730b6de768e
4
+ data.tar.gz: d4c05363b54d8ae4607890b9ab552eb9ba3fc486c39251dcaac028aee29e21b7
5
5
  SHA512:
6
- metadata.gz: 8c82e014b6a876cbe35e9fdfdd2ea10e296e6497b207623728ca6dae8a887fb7ac82e7f199da08febec7571e677b65c743dbc335731c72f2716447f4f367b4db
7
- data.tar.gz: 99c5bad156fbcb7d18084ee0523366f6334b5a9d5f2d89410fcad000a533a21be71806c53dea0f6b8f8d2f1ec36b488e86c65b36d5d4e067ca27e022f3f25bb1
6
+ metadata.gz: 11793b5496575f947eb481b53732310b47d6a5fa5601e0826cc2dcc5f79fec498712abeaf14c9be82c683da519e1b9c785b7265e8d1f86e0027178aae6a606f6
7
+ data.tar.gz: c24ea2e3ef4337788c13cd53b373815e621c2cac9b504015672206c7e57dc7f9cef18b4deb94563eab0f4c9a536802f693687433b5cb21cb98222c2ced48b7db
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [v0.14.0](https://github.com/metabahn/proc/releases/tag/2021-09-22)
2
+
3
+ *released on 2021-09-22*
4
+
5
+ * `chg` [#14](https://github.com/metabahn/proc/pull/14) Change Ruby client error handling to fallback to returning a result ([bryanp](https://github.com/bryanp))
6
+
1
7
  ## [v0.13.0](https://github.com/metabahn/proc/releases/tag/2021-09-15)
2
8
 
3
9
  *released on 2021-09-15*
data/lib/proc/client.rb CHANGED
@@ -171,27 +171,6 @@ class Proc
171
171
  status, headers, payload = get_payload(proc: proc, body: body)
172
172
 
173
173
  case status
174
- when 200
175
- result = extract_output(payload)
176
-
177
- if (cursor = headers["x-cursor"])
178
- enumerator = if cursor.empty?
179
- ::Proc::Enumerator.new(result)
180
- else
181
- ::Proc::Enumerator.new(result) {
182
- arguments[:cursor] = cursor.to_s
183
- call(proc, input, **arguments)
184
- }
185
- end
186
-
187
- if block
188
- enumerator.each(&block)
189
- else
190
- enumerator
191
- end
192
- else
193
- result
194
- end
195
174
  when 400
196
175
  ::Kernel.raise ::Proc::Invalid, extract_error_message(payload)
197
176
  when 401
@@ -211,7 +190,30 @@ class Proc
211
190
  when 508
212
191
  ::Kernel.raise ::Proc::Error, extract_error_message(payload)
213
192
  else
214
- ::Kernel.raise ::Proc::Error, "unhandled"
193
+ result = extract_output(payload)
194
+
195
+ if !result.nil?
196
+ if (cursor = headers["x-cursor"])
197
+ enumerator = if cursor.empty?
198
+ ::Proc::Enumerator.new(result)
199
+ else
200
+ ::Proc::Enumerator.new(result) {
201
+ arguments[:cursor] = cursor.to_s
202
+ call(proc, input, **arguments)
203
+ }
204
+ end
205
+
206
+ if block
207
+ enumerator.each(&block)
208
+ else
209
+ enumerator
210
+ end
211
+ else
212
+ result
213
+ end
214
+ elsif (error = extract_error_message(payload))
215
+ ::Kernel.raise ::Proc::Error, error
216
+ end
215
217
  end
216
218
  end
217
219
 
data/lib/proc/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Proc
4
- VERSION = "0.13.0"
4
+ VERSION = "0.14.0"
5
5
 
6
6
  # [public]
7
7
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-15 00:00:00.000000000 Z
11
+ date: 2021-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: core-async
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.2.15
118
+ rubygems_version: 3.2.22
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Proc client library.