elastomer-client 3.1.3 → 3.1.4
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/elastomer/client.rb +1 -0
- data/lib/elastomer/client/errors.rb +9 -7
- data/lib/elastomer/version.rb +1 -1
- data/script/cibuild-elastomer-client +1 -1
- data/test/client/errors_test.rb +1 -0
- data/test/client_test.rb +24 -0
- 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: 95877a6edd1749905c0b9636c0b42d79e2f3cd18
|
4
|
+
data.tar.gz: cb55f7960a4641fa174c04ba01323dfac7e7d277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ee2ea6983e25ab5a497da860079b021cc638ee735381cb35f3db59d7ae8f84698f9b529d946d6db8d27bf59f16754eebc4da9e52dfb2ca00e89e27a9dae7eb
|
7
|
+
data.tar.gz: dae314923477e94be91faac9da04468d02bdbfa9dc7882db676d5cba04205fc9a13d8f7cd36dc75881846c5a7c71c5c6c0923dae4bf31841f4bda31e959f99d4
|
data/lib/elastomer/client.rb
CHANGED
@@ -407,6 +407,7 @@ module Elastomer
|
|
407
407
|
case root_cause["type"]
|
408
408
|
when "index_not_found_exception"; raise IndexNotFoundError, response
|
409
409
|
when "illegal_argument_exception"; raise IllegalArgument, response
|
410
|
+
when "es_rejected_execution_exception"; raise RejectedExecutionError, response
|
410
411
|
when *version_support.query_parse_exception; raise QueryParsingError, response
|
411
412
|
end
|
412
413
|
|
@@ -85,13 +85,15 @@ module Elastomer
|
|
85
85
|
|
86
86
|
# Provide some nice errors for common Elasticsearch exceptions. These are
|
87
87
|
# all subclasses of the more general RequestError
|
88
|
-
IndexNotFoundError
|
89
|
-
QueryParsingError
|
90
|
-
SearchContextMissing
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
88
|
+
IndexNotFoundError = Class.new RequestError
|
89
|
+
QueryParsingError = Class.new RequestError
|
90
|
+
SearchContextMissing = Class.new RequestError
|
91
|
+
RejectedExecutionError = Class.new RequestError
|
92
|
+
|
93
|
+
ServerError.fatal = false
|
94
|
+
TimeoutError.fatal = false
|
95
|
+
ConnectionFailed.fatal = false
|
96
|
+
RejectedExecutionError.fatal = false
|
95
97
|
|
96
98
|
# Define an Elastomer::Client exception class on the fly for
|
97
99
|
# Faraday exception classes that we don't specifically wrap.
|
data/lib/elastomer/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
cibuild-elastomer-client-es24
|
data/test/client/errors_test.rb
CHANGED
@@ -71,6 +71,7 @@ describe Elastomer::Client::Error do
|
|
71
71
|
assert !Elastomer::Client::TimeoutError.fatal, "Timeouts are not fatal"
|
72
72
|
assert !Elastomer::Client::ConnectionFailed.fatal, "Connection failures are not fatal"
|
73
73
|
assert !Elastomer::Client::ServerError.fatal, "Server errors are not fatal"
|
74
|
+
assert !Elastomer::Client::RejectedExecutionError.fatal, "Rejected execution errors are not fatal"
|
74
75
|
end
|
75
76
|
|
76
77
|
if parameter_validation?
|
data/test/client_test.rb
CHANGED
@@ -33,6 +33,30 @@ describe Elastomer::Client do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
it "raises an error on rejected execution exceptions" do
|
37
|
+
rejected_execution_response = {
|
38
|
+
error: {
|
39
|
+
root_cause: [{
|
40
|
+
type: "es_rejected_execution_exception",
|
41
|
+
reason: "rejected execution of org.elasticsearch.transport.TransportService$7@5a787cd5 on EsThreadPoolExecutor[bulk, queue capacity = 200, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@1338862c[Running, pool size = 32, active threads = 32, queued tasks = 213, completed tasks = 193082975]]"
|
42
|
+
}],
|
43
|
+
type: "es_rejected_execution_exception",
|
44
|
+
reason: "rejected execution of org.elasticsearch.transport.TransportService$7@5a787cd5 on EsThreadPoolExecutor[bulk, queue capacity = 200, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@1338862c[Running, pool size = 32, active threads = 32, queued tasks = 213, completed tasks = 193082975]]"
|
45
|
+
}
|
46
|
+
}.to_json
|
47
|
+
|
48
|
+
stub_request(:post, $client.url+"/_bulk").to_return({
|
49
|
+
body: rejected_execution_response
|
50
|
+
})
|
51
|
+
|
52
|
+
begin
|
53
|
+
$client.post "/_bulk"
|
54
|
+
assert false, "exception was not raised when it should have been"
|
55
|
+
rescue Elastomer::Client::RejectedExecutionError => err
|
56
|
+
assert_match %r/es_rejected_execution_exception/, err.message
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
36
60
|
it "wraps Faraday errors with our own exceptions" do
|
37
61
|
error = Faraday::TimeoutError.new("it took too long")
|
38
62
|
wrapped = $client.wrap_faraday_error(error, :get, "/_cat/indices")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastomer-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Pease
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -341,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
341
|
version: '0'
|
342
342
|
requirements: []
|
343
343
|
rubyforge_project:
|
344
|
-
rubygems_version: 2.
|
344
|
+
rubygems_version: 2.5.2
|
345
345
|
signing_key:
|
346
346
|
specification_version: 4
|
347
347
|
summary: A library for interacting with Elasticsearch
|