Exception: Aspera::Transfer::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/aspera/transfer/error.rb

Overview

Error raised if transfer fails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description, code: nil) ⇒ Error

Returns a new instance of Error.

Parameters:

  • description (String)

    ‘Description` on management port

  • code (Integer) (defaults to: nil)

    ‘Description` on management port, use zero if unknown



14
15
16
17
# File 'lib/aspera/transfer/error.rb', line 14

def initialize(description, code: nil)
  super(description)
  @err_code = code.to_i
end

Instance Attribute Details

#err_codeObject (readonly)

Error code like on management port



10
11
12
# File 'lib/aspera/transfer/error.rb', line 10

def err_code
  @err_code
end

Instance Method Details

#infoHash

Returns Information on that error.

Returns:

  • (Hash)

    Information on that error



20
21
22
23
# File 'lib/aspera/transfer/error.rb', line 20

def info
  r = Ascp::Management::ERRORS[@err_code] || Ascp::Management::ERRORS[0]
  return r.merge({i: @err_code})
end

#retryable?Boolean

Is that transfer error retryable ?

Parameters:

  • message (String, nil)

    Optional actual message on management port

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/aspera/transfer/error.rb', line 27

def retryable?
  return false if @err_code.eql?(14) && message.eql?('Target address not available')
  info[:r]
end