Exception: OpenTopo::Errors::FileError

Inherits:
BaseError
  • Object
show all
Defined in:
lib/open_topo/errors/file_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = "", file_path: nil) ⇒ FileError

Returns a new instance of FileError.



8
9
10
11
# File 'lib/open_topo/errors/file_error.rb', line 8

def initialize(message = "", file_path: nil)
  super(message)
  @file_path = file_path
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



6
7
8
# File 'lib/open_topo/errors/file_error.rb', line 6

def file_path
  @file_path
end

Instance Method Details

#fileObject



13
14
15
16
17
18
19
# File 'lib/open_topo/errors/file_error.rb', line 13

def file
  return nil if @file_path.nil?

  File.open(@file_path)
rescue Errno::ENOENT
  nil
end