Exception: MilkTea::ModuleLoadError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/milk_tea/core/module_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, path:, line: nil, column: nil) ⇒ ModuleLoadError

Returns a new instance of ModuleLoadError.



7
8
9
10
11
12
# File 'lib/milk_tea/core/module_loader.rb', line 7

def initialize(message, path:, line: nil, column: nil)
  @path = path
  @line = line
  @column = column
  super("#{message}: #{path}")
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



5
6
7
# File 'lib/milk_tea/core/module_loader.rb', line 5

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



5
6
7
# File 'lib/milk_tea/core/module_loader.rb', line 5

def line
  @line
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/milk_tea/core/module_loader.rb', line 5

def path
  @path
end

Instance Method Details

#codeObject



14
15
16
# File 'lib/milk_tea/core/module_loader.rb', line 14

def code
  "module/error"
end

#to_diagnostic(path: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/milk_tea/core/module_loader.rb', line 18

def to_diagnostic(path: nil)
  Diagnostic.new(
    path: @path || path,
    line: @line,
    column: @column,
    length: nil,
    code: code,
    message: message,
    severity: :error,
  )
end