Exception: Kwartz::BaseError

Inherits:
KwartzError show all
Defined in:
lib/kwartz/error.rb

Direct Known Subclasses

ParseError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, filename, linenum, column = nil) ⇒ BaseError

Returns a new instance of BaseError.



19
20
21
22
23
24
# File 'lib/kwartz/error.rb', line 19

def initialize(message, filename, linenum, column=nil)
  super(message)
  @filename = filename || '-'
  @linenum = linenum
  @column = column
end

Instance Attribute Details

#columnObject

Returns the value of attribute column.



26
27
28
# File 'lib/kwartz/error.rb', line 26

def column
  @column
end

#filenameObject

Returns the value of attribute filename.



26
27
28
# File 'lib/kwartz/error.rb', line 26

def filename
  @filename
end

#linenumObject

Returns the value of attribute linenum.



26
27
28
# File 'lib/kwartz/error.rb', line 26

def linenum
  @linenum
end

Instance Method Details

#to_sObject



28
29
30
31
32
33
34
35
36
# File 'lib/kwartz/error.rb', line 28

def to_s
  return super unless @linenum
  #return "line #{@linenum}, column #{@column}: " + super
  if @column
    return "#{@filename}:#{@linenum}:#{@column}: " + super
  else
    return "#{@filename}:#{@linenum}: " + super
  end
end