elastomer-client 3.1.4 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/elastomer/client.rb +4 -0
- data/lib/elastomer/client/errors.rb +4 -3
- data/lib/elastomer/version.rb +1 -1
- data/test/client/docs_test.rb +17 -0
- data/test/client/errors_test.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a92c72bbd6205383dc51f6f1886c59b6dcd80c6
|
4
|
+
data.tar.gz: 5461381ed8be4b188ab38517365abcc35f2b6c8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62e6218d00e3a0957af8be8f1e5cc2bcb13bfdc275bd6ab75dc88cdb79564f416abf5e606561dcb3d9226032a4fc03d56b585cb0c8ae6c0c07e74d2e2b7040cc
|
7
|
+
data.tar.gz: 1612c188db262177c9a2d11cc4982165ab42057538d62a073f5a80e9a257b3d415be108fb5de52b3a19ceec1864d2193db289371d5740433e86f8e70d38fc513
|
data/CHANGELOG.md
CHANGED
data/lib/elastomer/client.rb
CHANGED
@@ -408,6 +408,10 @@ module Elastomer
|
|
408
408
|
when "index_not_found_exception"; raise IndexNotFoundError, response
|
409
409
|
when "illegal_argument_exception"; raise IllegalArgument, response
|
410
410
|
when "es_rejected_execution_exception"; raise RejectedExecutionError, response
|
411
|
+
# Elasticsearch 2.x.x root_cause type for document already existing
|
412
|
+
when "document_already_exists_exception"; raise DocumentAlreadyExistsError, response
|
413
|
+
# Elasticsearch 5.x.x root_cause type for document already existing
|
414
|
+
when "version_conflict_engine_exception"; raise DocumentAlreadyExistsError, response
|
411
415
|
when *version_support.query_parse_exception; raise QueryParsingError, response
|
412
416
|
end
|
413
417
|
|
@@ -85,10 +85,11 @@ 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
|
88
|
+
IndexNotFoundError = Class.new RequestError
|
89
|
+
QueryParsingError = Class.new RequestError
|
90
|
+
SearchContextMissing = Class.new RequestError
|
91
91
|
RejectedExecutionError = Class.new RequestError
|
92
|
+
DocumentAlreadyExistsError = Class.new RequestError
|
92
93
|
|
93
94
|
ServerError.fatal = false
|
94
95
|
TimeoutError.fatal = false
|
data/lib/elastomer/version.rb
CHANGED
data/test/client/docs_test.rb
CHANGED
@@ -41,6 +41,23 @@ describe Elastomer::Client::Docs do
|
|
41
41
|
@index.delete if @index.exists?
|
42
42
|
end
|
43
43
|
|
44
|
+
it "raises error when writing same document twice" do
|
45
|
+
document = {
|
46
|
+
:_id => "documentid",
|
47
|
+
:_type => "doc2",
|
48
|
+
:_op_type => "create",
|
49
|
+
:title => "the author of logging",
|
50
|
+
:author => "pea53"
|
51
|
+
}
|
52
|
+
h = @docs.index document.dup
|
53
|
+
|
54
|
+
assert_created h
|
55
|
+
|
56
|
+
assert_raises(Elastomer::Client::DocumentAlreadyExistsError) do
|
57
|
+
@docs.index document.dup
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
44
61
|
it "autogenerates IDs for documents" do
|
45
62
|
h = @docs.index \
|
46
63
|
:_type => "doc2",
|
data/test/client/errors_test.rb
CHANGED
@@ -65,6 +65,7 @@ describe Elastomer::Client::Error do
|
|
65
65
|
assert Elastomer::Client::ParsingError.fatal, "Parsing error is fatal"
|
66
66
|
assert Elastomer::Client::SSLError.fatal, "SSL error is fatal"
|
67
67
|
assert Elastomer::Client::RequestError.fatal, "Request error is fatal"
|
68
|
+
assert Elastomer::Client::DocumentAlreadyExistsError.fatal, "DocumentAlreadyExistsError error is fatal"
|
68
69
|
end
|
69
70
|
|
70
71
|
it "has some non-fatal subclasses" do
|
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.5
|
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: 2019-
|
12
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|