redcord 0.1.5 → 0.1.6
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/redcord/actions.rb +14 -9
- data/lib/redcord/attribute.rb +0 -3
- data/lib/redcord/errors.rb +18 -0
- data/lib/redcord/relation.rb +0 -4
- data/lib/redcord/serializer.rb +0 -8
- data/lib/redcord.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91184713358e549897cc7d1a544a8f8244b2aa267b623a6af947711219983ce5
|
4
|
+
data.tar.gz: d24d9e8f1f5cfa72afc6c4f2bfe64933f8f7278ed3dd7a3a53f4ae026168a732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 828c660a25ea131fc013ba261cb3395fbbcc637170f5b8601f68e30f7095cda8f5e3ed5781bcbb0bf39fcec693438953b76b4a106b9fd9966e3c5f3ff6469145
|
7
|
+
data.tar.gz: e3a6469ae8778ea5c110922c7324c43e394e273c0392a16524bbe489fd24df4bffca4cd83c7a225430b05ac134e346dad9de64e2514f87caddf249704209961d
|
data/lib/redcord/actions.rb
CHANGED
@@ -3,15 +3,8 @@
|
|
3
3
|
# typed: strict
|
4
4
|
|
5
5
|
require 'sorbet-coerce'
|
6
|
-
|
7
6
|
require 'redcord/relation'
|
8
7
|
|
9
|
-
module Redcord
|
10
|
-
# Raised by Model.find
|
11
|
-
class RecordNotFound < StandardError; end
|
12
|
-
class InvalidAction < StandardError; end
|
13
|
-
end
|
14
|
-
|
15
8
|
module Redcord::Actions
|
16
9
|
extend T::Sig
|
17
10
|
extend T::Helpers
|
@@ -171,6 +164,13 @@ module Redcord::Actions
|
|
171
164
|
)
|
172
165
|
end
|
173
166
|
end
|
167
|
+
# TODO: break down Redis::CommandError further by parsing the error message
|
168
|
+
rescue Redis::CommandError => e
|
169
|
+
if e.message.include?('has been deleted')
|
170
|
+
raise Redcord::RedcordDeletedError.new(e)
|
171
|
+
else
|
172
|
+
raise e
|
173
|
+
end
|
174
174
|
end
|
175
175
|
|
176
176
|
sig { returns(T::Boolean) }
|
@@ -179,7 +179,6 @@ module Redcord::Actions
|
|
179
179
|
|
180
180
|
true
|
181
181
|
rescue Redis::CommandError
|
182
|
-
# TODO: break down Redis::CommandError by parsing the error message
|
183
182
|
false
|
184
183
|
end
|
185
184
|
|
@@ -213,6 +212,13 @@ module Redcord::Actions
|
|
213
212
|
)
|
214
213
|
end
|
215
214
|
end
|
215
|
+
# TODO: break down Redis::CommandError further by parsing the error message
|
216
|
+
rescue Redis::CommandError => e
|
217
|
+
if e.message.include?('has been deleted')
|
218
|
+
raise Redcord::RedcordDeletedError.new(e)
|
219
|
+
else
|
220
|
+
raise e
|
221
|
+
end
|
216
222
|
end
|
217
223
|
|
218
224
|
sig { params(args: T::Hash[Symbol, T.untyped]).returns(T::Boolean) }
|
@@ -221,7 +227,6 @@ module Redcord::Actions
|
|
221
227
|
|
222
228
|
true
|
223
229
|
rescue Redis::CommandError
|
224
|
-
# TODO: break down Redis::CommandError by parsing the error message
|
225
230
|
false
|
226
231
|
end
|
227
232
|
|
data/lib/redcord/attribute.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Redcord
|
4
|
+
# Raised by Model.find
|
5
|
+
class RecordNotFound < StandardError; end
|
6
|
+
class InvalidAction < StandardError; end
|
7
|
+
|
8
|
+
# Raised by Model.where
|
9
|
+
class InvalidQuery < StandardError; end
|
10
|
+
class AttributeNotIndexed < StandardError; end
|
11
|
+
class WrongAttributeType < TypeError; end
|
12
|
+
class CustomIndexInvalidQuery < StandardError; end
|
13
|
+
class CustomIndexInvalidDesign < StandardError; end
|
14
|
+
class RedcordDeletedError < ::Redis::CommandError; end
|
15
|
+
|
16
|
+
# Raised by shared_by_attribute
|
17
|
+
class InvalidAttribute < StandardError; end
|
18
|
+
end
|
data/lib/redcord/relation.rb
CHANGED
data/lib/redcord/serializer.rb
CHANGED
@@ -4,14 +4,6 @@
|
|
4
4
|
|
5
5
|
require 'redcord/range_interval'
|
6
6
|
|
7
|
-
module Redcord
|
8
|
-
# Raised by Model.where
|
9
|
-
class AttributeNotIndexed < StandardError; end
|
10
|
-
class WrongAttributeType < TypeError; end
|
11
|
-
class CustomIndexInvalidQuery < StandardError; end
|
12
|
-
class CustomIndexInvalidDesign < StandardError; end
|
13
|
-
end
|
14
|
-
|
15
7
|
# This module defines various helper methods on Redcord for serialization
|
16
8
|
# between the Ruby client and Redis server.
|
17
9
|
module Redcord::Serializer
|
data/lib/redcord.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redcord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chan Zuckerberg Initiative
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- lib/redcord/base.rb
|
178
178
|
- lib/redcord/configurations.rb
|
179
179
|
- lib/redcord/connection_pool.rb
|
180
|
+
- lib/redcord/errors.rb
|
180
181
|
- lib/redcord/logger.rb
|
181
182
|
- lib/redcord/lua_script_reader.rb
|
182
183
|
- lib/redcord/migration.rb
|