sorbet-runtime 0.5.6380 → 0.5.6382
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf2148f2c8b83fe261d42135aebb10b7e4bd6ed53981cf3cca3aef02dc973edb
|
4
|
+
data.tar.gz: b353a661bcc6f804f657c340af961ecdf076e773283d9e8b5d9ab925544846dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eea8c3e5cf69f0282dd20bc012a9fee55b33e8457c5c3b83c5b4a40d6f9e00eb11c5f446e01d7beda09153d7243305c66d3bf2ef7a5cecad3691a503ea453ed
|
7
|
+
data.tar.gz: 19cf13cd5b49c076f187fff4863ad5d1d09e7bcd2b8941a01cc2d4c5a85a0dcb8bc996e839c0c73660324a2c6cad0b08e9d666a7aec74833a5c10caa48cdac3b
|
data/lib/types/configuration.rb
CHANGED
@@ -290,51 +290,6 @@ module T::Configuration
|
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
293
|
-
# Set a handler for deserialization errors
|
294
|
-
#
|
295
|
-
# These generally shouldn't stop execution of the program, but rather inform
|
296
|
-
# some party of the error to action on later.
|
297
|
-
#
|
298
|
-
# @param [Lambda, Proc, Object, nil] value Proc that handles the error
|
299
|
-
# report (pass nil to reset to default behavior)
|
300
|
-
#
|
301
|
-
# Parameters passed to value.call:
|
302
|
-
#
|
303
|
-
# @param [Class] klass The class of the top-level object being deserialized
|
304
|
-
# @param [String] prop_name The name of the prop being deserialized
|
305
|
-
# @param [Object] value The prop value being deserialized
|
306
|
-
# @param [Error] orig_error The original error raised during deserialization
|
307
|
-
#
|
308
|
-
# @example
|
309
|
-
# T::Configuration.deserialization_error_handler = lambda do |klass, prop_name, value, orig_error}
|
310
|
-
# puts "Error deserializing #{prop_name} on #{klass}: #{orig_error.message}
|
311
|
-
# end
|
312
|
-
def self.deserialization_error_handler=(value)
|
313
|
-
validate_lambda_given!(value)
|
314
|
-
@deserialization_error_handler = value
|
315
|
-
end
|
316
|
-
|
317
|
-
private_class_method def self.deserialization_error_handler_default(klass, prop_name, value, orig_error)
|
318
|
-
soft_assert_handler(
|
319
|
-
'Deserialization error (probably unexpected stored type)',
|
320
|
-
storytime: {
|
321
|
-
klass: klass,
|
322
|
-
prop: prop_name,
|
323
|
-
value: value,
|
324
|
-
error: orig_error.message,
|
325
|
-
notify: 'djudd'
|
326
|
-
}
|
327
|
-
)
|
328
|
-
end
|
329
|
-
|
330
|
-
def self.deserialization_error_handler(klass, prop_name, value, orig_error)
|
331
|
-
if @deserialization_error_handler
|
332
|
-
@deserialization_error_handler.call(klass, prop_name, value, orig_error)
|
333
|
-
else
|
334
|
-
deserialization_error_handler_default(klass, prop_name, value, orig_error)
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
293
|
# Set a handler for soft assertions
|
339
294
|
#
|
340
295
|
# These generally shouldn't stop execution of the program, but rather inform
|
@@ -261,8 +261,7 @@ module T::Props
|
|
261
261
|
private_class_method def self.whitelisted_methods_for_deserialize
|
262
262
|
@whitelisted_methods_for_deserialize ||= {
|
263
263
|
lvar: %i{dup map transform_values transform_keys each_with_object nil? []= to_f},
|
264
|
-
|
265
|
-
const: %i[deserialize from_hash deep_clone_object deserialization_error_handler],
|
264
|
+
const: %i[deserialize from_hash deep_clone_object soft_assert_handler],
|
266
265
|
}
|
267
266
|
end
|
268
267
|
end
|
@@ -57,11 +57,15 @@ module T::Props
|
|
57
57
|
begin
|
58
58
|
#{transformation}
|
59
59
|
rescue NoMethodError => e
|
60
|
-
T::Configuration.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
T::Configuration.soft_assert_handler(
|
61
|
+
'Deserialization error (probably unexpected stored type)',
|
62
|
+
storytime: {
|
63
|
+
klass: self.class,
|
64
|
+
prop: #{prop.inspect},
|
65
|
+
value: val,
|
66
|
+
error: e.message,
|
67
|
+
notify: 'djudd'
|
68
|
+
}
|
65
69
|
)
|
66
70
|
val
|
67
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorbet-runtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6382
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|