Exception: Yay::InstallFailedError

Inherits:
Error
  • Object
show all
Defined in:
lib/yay/errors.rb

Overview

this error wraps an underlying error

Constant Summary collapse

MAX_LENGTH =
1028

Instance Attribute Summary collapse

Attributes inherited from Error

#position

Instance Method Summary collapse

Methods inherited from Error

#printable_position

Constructor Details

#initialize(url, error, content = nil) ⇒ InstallFailedError

Returns a new instance of InstallFailedError.



46
47
48
49
50
51
52
53
54
# File 'lib/yay/errors.rb', line 46

def initialize url, error, content=nil
  @url     = url
  @error   = error
  @content = content
  @content = 'empty' if (content==nil||content.strip=="")
  if @content.length >= InstallFailedError::MAX_LENGTH
    @content = "#{@content.slice(0,InstallFailedError::MAX_LENGTH)}\n.."
  end
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



44
45
46
# File 'lib/yay/errors.rb', line 44

def content
  @content
end

#errorObject (readonly)

Returns the value of attribute error.



42
43
44
# File 'lib/yay/errors.rb', line 42

def error
  @error
end

#urlObject (readonly)

Returns the value of attribute url.



43
44
45
# File 'lib/yay/errors.rb', line 43

def url
  @url
end

Instance Method Details

#printable_messageObject



56
57
58
# File 'lib/yay/errors.rb', line 56

def printable_message
  return "Failed to download and install file from #{url}\nReason: #{error}\nResponse was:\n#{content}\nCheck your url!"
end