Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit d6ffc09

Browse files
authored
Merge pull request #20 from cipherstash/fix-up-error-message
Update error returned to a RecordPutError
2 parents 29290dc + 7cefa23 commit d6ffc09

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

lib/cipherstash/client/error.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ class DocumentQueryFailure < RPCFailure; end
6767
# An error occured while migration records.
6868
class RecordMigrateFailure < Error; end
6969

70+
# A client error occured while storing a record.
71+
class RecordPutError < Error; end
72+
7073
# A query constraint was specified incorrectly.
7174
#
7275
# Either a non-existent index was referenced, or an operator was specified that is not supported on the given index.

lib/cipherstash/client/rpc.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def put(collection, id, record, vectors)
161161
rescue ::GRPC::NotFound
162162
raise Error::RecordPutFailure, "Collection '#{collection.name}' not found"
163163
rescue ::GRPC::InvalidArgument => ex
164-
raise Error::RecordPutFailure, "Error while putting record into collection '#{collection.name}': #{ex.message} (#{ex.class})"
164+
raise Error::RecordPutError, "Error while putting record into collection '#{collection.name}': #{ex.message} (#{ex.class})"
165165
rescue ::GRPC::BadStatus => ex
166166
raise Error::RecordPutFailure, "Error while putting records into collection '#{collection.name}': #{ex.message} (#{ex.class})"
167167
end
@@ -284,7 +284,7 @@ def put_stream(collection, records)
284284
rescue ::GRPC::NotFound
285285
raise Error::RecordPutFailure, "Collection '#{collection.name}' not found"
286286
rescue ::GRPC::InvalidArgument => ex
287-
raise Error::RecordPutFailure, "Error while putting records into collection '#{collection.name}': #{ex.message} (#{ex.class})"
287+
raise Error::RecordPutError, "Error while putting records into collection '#{collection.name}': #{ex.message} (#{ex.class})"
288288
rescue ::GRPC::BadStatus => ex
289289
raise Error::RecordPutFailure, "Error while putting records into collection '#{collection.name}': #{ex.message} (#{ex.class})"
290290
end

0 commit comments

Comments
 (0)