Exception: Aspera::Plugins::Server::AsCmd::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/aspera/plugins/server/ascmd.rb

Overview

Raised when one or more commands of ascmd failed. The other commands were executed. Subclass NotFound or AccessDenied when all commands failed for this reason.

Direct Known Subclasses

AccessDenied, NotFound

Defined Under Namespace

Classes: Failure

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, failures) ⇒ Error

Returns a new instance of Error.

Parameters:

  • operation (Symbol) —

    the operation

  • failures (Array<Failure>) —

    failed commands



101
102
103
104
105
# File 'lib/aspera/plugins/server/ascmd.rb', line 101

def initialize(operation, failures)
  @operation = operation
  @failures = failures
  super(failures.map { |f| "ascmd: #{f.errstr}#{" (#{f.errno})" unless f.errno.nil?}" }.join("\n"))
end

Instance Attribute Details

#failures ⇒ Array<Failure> (readonly)

Returns failed commands, in order.

Returns:

  • (Array<Failure>) —

    failed commands, in order



97
98
99
# File 'lib/aspera/plugins/server/ascmd.rb', line 97

def failures
  @failures
end

#operation ⇒ Symbol (readonly)

Returns the operation.

Returns:

  • (Symbol) —

    the operation



95
96
97
# File 'lib/aspera/plugins/server/ascmd.rb', line 95

def operation
  @operation
end

Instance Method Details

#extended_message ⇒ String

Returns one line per failed command, with its arguments.

Returns:

  • (String) —

    one line per failed command, with its arguments



108
109
110
# File 'lib/aspera/plugins/server/ascmd.rb', line 108

def extended_message
  @failures.map { |f| %Q{errno=#{f.errno} errstr="#{f.errstr}" command=#{@operation} arguments=#{f.arguments.join(',')}} }.join("\n")
end