class Tanker::Error

Main error class for errors returned by native tanker futures

Constants

CONFLICT
DECRYPTION_FAILED
DEVICE_REVOKED
ERROR_CODE_TO_CLASS
EXPIRED_VERIFICATION
GROUP_TOO_BIG
IDENTITY_ALREADY_ATTACHED
INTERNAL_ERROR
INVALID_ARGUMENT

Error code constants

INVALID_VERIFICATION
IO_ERROR
NETWORK_ERROR
OPERATION_CANCELED
PRECONDITION_FAILED
TOO_MANY_ATTEMPTS
UPGRADE_REQUIRED

Attributes

code[R]
message[R]

Public Class Methods

from_ctanker_error(ctanker_error) click to toggle source
# File lib/tanker/error.rb, line 72
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
new(ctanker_error) click to toggle source
Calls superclass method
# File lib/tanker/error.rb, line 11
def initialize(ctanker_error)
  @code = ctanker_error[:error_code]
  @message = ctanker_error[:error_message]
  super(@message)
end