Exception: RemotePartial::RemotePartialRetrivalError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/remote_partial/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, source) ⇒ RemotePartialRetrivalError

Returns a new instance of RemotePartialRetrivalError.



6
7
8
9
# File 'lib/remote_partial/exceptions.rb', line 6

def initialize(url, source)
  @url = url
  @source = source
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



4
5
6
# File 'lib/remote_partial/exceptions.rb', line 4

def source
  @source
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/remote_partial/exceptions.rb', line 4

def url
  @url
end

Instance Method Details

#error_messageObject



15
16
17
18
19
20
21
# File 'lib/remote_partial/exceptions.rb', line 15

def error_message
  if source.class == RuntimeError
    source.message
  else
    source.inspect
  end
end

#messageObject



11
12
13
# File 'lib/remote_partial/exceptions.rb', line 11

def message
  "Unable to retrieve remote partial at #{url}: #{error_message}"
end