Exception: Tanker::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Tanker::Error
- Defined in:
- lib/tanker/error.rb
Overview
Main error class for errors returned by native tanker futures
Direct Known Subclasses
Conflict, DecryptionFailed, ExpiredVerification, GroupTooBig, IOError, IdentityAlreadyAttached, InternalError, InvalidArgument, InvalidVerification, NetworkError, OperationCanceled, PreconditionFailed, TooManyAttempts, UpgradeRequired
Defined Under Namespace
Classes: Conflict, DecryptionFailed, ExpiredVerification, GroupTooBig, IOError, IdentityAlreadyAttached, InternalError, InvalidArgument, InvalidVerification, NetworkError, OperationCanceled, PreconditionFailed, TooManyAttempts, UpgradeRequired
Constant Summary collapse
- INVALID_ARGUMENT =
Error code constants
1
- INTERNAL_ERROR =
2
- NETWORK_ERROR =
3
- PRECONDITION_FAILED =
4
- OPERATION_CANCELED =
5
- DECRYPTION_FAILED =
6
- GROUP_TOO_BIG =
7
- INVALID_VERIFICATION =
8
- TOO_MANY_ATTEMPTS =
9
- EXPIRED_VERIFICATION =
10
- IO_ERROR =
11
- CONFLICT =
DEVICE_REVOKED = 12
13
- UPGRADE_REQUIRED =
14
- IDENTITY_ALREADY_ATTACHED =
15
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ctanker_error) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(ctanker_error) ⇒ Error
Returns a new instance of Error.
11 12 13 14 15 |
# File 'lib/tanker/error.rb', line 11 def initialize(ctanker_error) @code = ctanker_error[:error_code] @message = ctanker_error[:error_message] super(@message) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
8 9 10 |
# File 'lib/tanker/error.rb', line 8 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/tanker/error.rb', line 9 def @message end |
Class Method Details
.from_ctanker_error(ctanker_error) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/tanker/error.rb', line 70 def from_ctanker_error(ctanker_error) error_code = ctanker_error[:error_code] error_class = ERROR_CODE_TO_CLASS[error_code] if error_class.nil? InternalError.new( error_code: INTERNAL_ERROR, error_message: "Unknown error code returned by ctanker: #{error_code} - #{ctanker_error[:error_message]}" ) else error_class.new ctanker_error end end |