tanker-core 2.6.3.beta.1 → 2.6.5.alpha.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 582102dec21dbf12f2290d41d233059bd61d9ed3f51d6bbbc7b7de40515f4356
|
4
|
+
data.tar.gz: fdcc768ed1c4c665051961c9009b8871f8b97a00459afc9970cc97ffc74ff335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85ddf17092e5d31e66ac23c600a99a9618db68173cb910cfbefb5eb4f7d5ca9727984b2eea8f7c2a0d9457143cc6c264fba8a6f9ca6c4daf5751d18ee94dd7a4
|
7
|
+
data.tar.gz: 76369403bc0317f7c3016841feb81822c13b206cc4d11fca2e5295c0dc6bf1b1ef0215aef7559ae73e76710bc9578500410ee311805520f190f919d78f2f9cf4
|
@@ -25,7 +25,7 @@ module Tanker
|
|
25
25
|
CTanker.tanker_future_wait @cfuture
|
26
26
|
if CTanker.tanker_future_has_error @cfuture
|
27
27
|
cerr = CTanker.tanker_future_get_error @cfuture
|
28
|
-
raise Error
|
28
|
+
raise Error.from_ctanker_error(cerr)
|
29
29
|
else
|
30
30
|
CTanker.tanker_future_get_voidptr @cfuture
|
31
31
|
end
|
data/lib/tanker/core/stream.rb
CHANGED
data/lib/tanker/core/version.rb
CHANGED
data/lib/tanker/error.rb
CHANGED
@@ -3,33 +3,82 @@
|
|
3
3
|
require 'tanker/c_tanker/c_tanker_error'
|
4
4
|
|
5
5
|
module Tanker
|
6
|
-
#
|
6
|
+
# Main error class for errors returned by native tanker futures
|
7
7
|
class Error < StandardError
|
8
|
-
|
8
|
+
attr_reader :code
|
9
|
+
attr_reader :message
|
10
|
+
|
11
|
+
def initialize(ctanker_error)
|
12
|
+
@code = ctanker_error[:error_code]
|
13
|
+
@message = ctanker_error[:error_message]
|
14
|
+
super(@message)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Error code constants
|
9
18
|
INVALID_ARGUMENT = 1
|
10
19
|
INTERNAL_ERROR = 2
|
11
20
|
NETWORK_ERROR = 3
|
12
21
|
PRECONDITION_FAILED = 4
|
13
22
|
OPERATION_CANCELED = 5
|
14
|
-
|
15
23
|
DECRYPTION_FAILED = 6
|
16
|
-
|
17
24
|
GROUP_TOO_BIG = 7
|
18
|
-
|
19
25
|
INVALID_VERIFICATION = 8
|
20
26
|
TOO_MANY_ATTEMPTS = 9
|
21
27
|
EXPIRED_VERIFICATION = 10
|
22
28
|
IO_ERROR = 11
|
23
29
|
DEVICE_REVOKED = 12
|
24
|
-
|
25
30
|
CONFLICT = 13
|
31
|
+
UPGRADE_REQUIRED = 14
|
26
32
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
33
|
+
# Error subclasses
|
34
|
+
class InvalidArgument < self; end
|
35
|
+
class InternalError < self; end
|
36
|
+
class NetworkError < self; end
|
37
|
+
class PreconditionFailed < self; end
|
38
|
+
class OperationCanceled < self; end
|
39
|
+
class DecryptionFailed < self; end
|
40
|
+
class GroupTooBig < self; end
|
41
|
+
class InvalidVerification < self; end
|
42
|
+
class TooManyAttempts < self; end
|
43
|
+
class ExpiredVerification < self; end
|
44
|
+
class IOError < self; end
|
45
|
+
class DeviceRevoked < self; end
|
46
|
+
class Conflict < self; end
|
47
|
+
class UpgradeRequired < self; end
|
31
48
|
|
32
|
-
|
33
|
-
|
49
|
+
class << self
|
50
|
+
ERROR_CODE_TO_CLASS = {
|
51
|
+
INVALID_ARGUMENT => InvalidArgument,
|
52
|
+
INTERNAL_ERROR => InternalError,
|
53
|
+
NETWORK_ERROR => NetworkError,
|
54
|
+
PRECONDITION_FAILED => PreconditionFailed,
|
55
|
+
OPERATION_CANCELED => OperationCanceled,
|
56
|
+
DECRYPTION_FAILED => DecryptionFailed,
|
57
|
+
GROUP_TOO_BIG => GroupTooBig,
|
58
|
+
INVALID_VERIFICATION => InvalidVerification,
|
59
|
+
TOO_MANY_ATTEMPTS => TooManyAttempts,
|
60
|
+
EXPIRED_VERIFICATION => ExpiredVerification,
|
61
|
+
IO_ERROR => IOError,
|
62
|
+
DEVICE_REVOKED => DeviceRevoked,
|
63
|
+
CONFLICT => Conflict,
|
64
|
+
UPGRADE_REQUIRED => UpgradeRequired
|
65
|
+
}.freeze
|
66
|
+
|
67
|
+
private_constant :ERROR_CODE_TO_CLASS
|
68
|
+
|
69
|
+
def from_ctanker_error(ctanker_error)
|
70
|
+
error_code = ctanker_error[:error_code]
|
71
|
+
error_class = ERROR_CODE_TO_CLASS[error_code]
|
72
|
+
|
73
|
+
if error_class.nil?
|
74
|
+
InternalError.new(
|
75
|
+
error_code: INTERNAL_ERROR,
|
76
|
+
error_message: "Unknown error code returned by ctanker: #{error_code} - #{ctanker_error[:error_message]}"
|
77
|
+
)
|
78
|
+
else
|
79
|
+
error_class.new ctanker_error
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
34
83
|
end
|
35
84
|
end
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tanker-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.5.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanker team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|