redcord 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf6ea43c415c480fb7b3484deb69005c13f52bb644fef52f5570d078b15baf46
4
- data.tar.gz: 0ae55fe438326a9fac46364e6ca0652d71da69aadae9dd204477f1ef502211fc
3
+ metadata.gz: 91184713358e549897cc7d1a544a8f8244b2aa267b623a6af947711219983ce5
4
+ data.tar.gz: d24d9e8f1f5cfa72afc6c4f2bfe64933f8f7278ed3dd7a3a53f4ae026168a732
5
5
  SHA512:
6
- metadata.gz: 5f45e3e9bb1c575051df21af680a817bff3a1bb2a367adba95258ab23535cb0fb08d024008edfdd16c58e4132bf67037e7f8bb8ce947e494323ef23a33e4ab1a
7
- data.tar.gz: d99aa9db0fec8580aacb6fa066612b6cc39c4028fb5a2af4c3c2bc03e851c1bdfa58a2eb17c121e148fef171a1913ed5086e4a2abc877fa47149aa701b260092
6
+ metadata.gz: 828c660a25ea131fc013ba261cb3395fbbcc637170f5b8601f68e30f7095cda8f5e3ed5781bcbb0bf39fcec693438953b76b4a106b9fd9966e3c5f3ff6469145
7
+ data.tar.gz: e3a6469ae8778ea5c110922c7324c43e394e273c0392a16524bbe489fd24df4bffca4cd83c7a225430b05ac134e346dad9de64e2514f87caddf249704209961d
@@ -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
 
@@ -1,9 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # typed: strict
4
- module Redcord
5
- class InvalidAttribute < StandardError; end
6
- end
7
4
 
8
5
  module Redcord::Attribute
9
6
  extend T::Sig
@@ -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
@@ -6,10 +6,6 @@ require 'active_support'
6
6
  require 'active_support/core_ext/array'
7
7
  require 'active_support/core_ext/module'
8
8
 
9
- module Redcord
10
- class InvalidQuery < StandardError; end
11
- end
12
-
13
9
  class Redcord::Relation
14
10
  extend T::Sig
15
11
 
@@ -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
@@ -32,6 +32,7 @@ module Redcord
32
32
  end
33
33
 
34
34
  require 'redcord/base'
35
+ require 'redcord/errors'
35
36
  require 'redcord/migration'
36
37
  require 'redcord/migration/migrator'
37
38
  require 'redcord/migration/version'
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.5
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