Exception: Webgen::LoadError

Inherits:
Error
  • Object
show all
Defined in:
lib/webgen/error.rb

Overview

This error is raised when a needed library is not found.

Instance Attribute Summary collapse

Attributes inherited from Error

#location, #path

Instance Method Summary collapse

Methods inherited from Error

error_file, error_line, #message

Constructor Details

#initialize(library_or_error, location = nil, path = nil, gem = nil) ⇒ LoadError

Create a new LoadError.

If library_or_error is a String, it is treated as the missing library name and an approriate error message is created. If it is an exception, the exception is wrapped.



113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/webgen/error.rb', line 113

def initialize(library_or_error, location = nil, path = nil, gem = nil)
  if library_or_error.kind_of?(String)
    msg = "The needed library '#{library_or_error}' is missing."
    msg << " You can install it with rubygems by running 'gem install #{gem}'!" if gem
    super(msg, location, path)
    @library = library_or_error
  else
    super(library_or_error, location, path)
    @library = nil
  end
  @gem = gem
end

Instance Attribute Details

#gemObject (readonly)

The name of the Rubygem that provides the missing library.



107
108
109
# File 'lib/webgen/error.rb', line 107

def gem
  @gem
end

#libraryObject (readonly)

The name of the library that is missing.



104
105
106
# File 'lib/webgen/error.rb', line 104

def library
  @library
end