Exception: Aptly::Errors::RepositoryFileError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/aptly/errors.rb

Overview

Raised when a file operation had an error.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(failures, warnings, *args) ⇒ RepositoryFileError

Create a new error instance.

Parameters:


47
48
49
50
51
# File 'lib/aptly/errors.rb', line 47

def initialize(failures, warnings, *args)
  super(*args)
  @failures = failures
  @warnings = warnings
end

Instance Attribute Details

#failuresArray<String>

Returns list of failed files.

Returns:

  • (Array<String>)

    list of failed files


37
38
39
# File 'lib/aptly/errors.rb', line 37

def failures
  @failures
end

#warningsArray<String>

Returns warnings from remote (one per file generally).

Returns:

  • (Array<String>)

    warnings from remote (one per file generally)


41
42
43
# File 'lib/aptly/errors.rb', line 41

def warnings
  @warnings
end

Class Method Details

.from_hash(hash, *args) ⇒ RepositoryFileError?

Construct a new instance from a hash

Parameters:

  • hash

    a file operation repsonse hash

Returns:

  • (RepositoryFileError)

    new error

  • (nil)

    if error is not applicable (hash has empty FailedFiles array)


72
73
74
75
# File 'lib/aptly/errors.rb', line 72

def from_hash(hash, *args)
  return nil if hash['FailedFiles'].empty?
  new(hash['FailedFiles'], hash['Report']['Warnings'], *args)
end

Instance Method Details

#to_sString

Returns (formatted) string representation.

Returns:

  • (String)

    (formatted) string representation


54
55
56
57
58
59
60
61
62
63
64
# File 'lib/aptly/errors.rb', line 54

def to_s
  <<-DESCRIPTION

~~~
  Failed to process:
    #{failures.join("\n    ")}
  Warnings:
    #{warnings.join("\n    ")}
~~~
  DESCRIPTION
end