elastomer-client 3.1.4 → 3.1.5

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
  SHA1:
3
- metadata.gz: 95877a6edd1749905c0b9636c0b42d79e2f3cd18
4
- data.tar.gz: cb55f7960a4641fa174c04ba01323dfac7e7d277
3
+ metadata.gz: 3a92c72bbd6205383dc51f6f1886c59b6dcd80c6
4
+ data.tar.gz: 5461381ed8be4b188ab38517365abcc35f2b6c8a
5
5
  SHA512:
6
- metadata.gz: 33ee2ea6983e25ab5a497da860079b021cc638ee735381cb35f3db59d7ae8f84698f9b529d946d6db8d27bf59f16754eebc4da9e52dfb2ca00e89e27a9dae7eb
7
- data.tar.gz: dae314923477e94be91faac9da04468d02bdbfa9dc7882db676d5cba04205fc9a13d8f7cd36dc75881846c5a7c71c5c6c0923dae4bf31841f4bda31e959f99d4
6
+ metadata.gz: 62e6218d00e3a0957af8be8f1e5cc2bcb13bfdc275bd6ab75dc88cdb79564f416abf5e606561dcb3d9226032a4fc03d56b585cb0c8ae6c0c07e74d2e2b7040cc
7
+ data.tar.gz: 1612c188db262177c9a2d11cc4982165ab42057538d62a073f5a80e9a257b3d415be108fb5de52b3a19ceec1864d2193db289371d5740433e86f8e70d38fc513
@@ -1,3 +1,6 @@
1
+ ## 3.1.5 (2019-06-26)
2
+ - Add new more granular exception type
3
+
1
4
  ## 3.1.1 (2018-02-24)
2
5
  - Output opaque ID information when a conflict is detected
3
6
  - Updating the `semantic` gem
@@ -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 = Class.new RequestError
89
- QueryParsingError = Class.new RequestError
90
- SearchContextMissing = Class.new RequestError
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
@@ -1,5 +1,5 @@
1
1
  module Elastomer
2
- VERSION = "3.1.4"
2
+ VERSION = "3.1.5"
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -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",
@@ -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
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-01-14 00:00:00.000000000 Z
12
+ date: 2019-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable