Class: Y2Issues::Issue

Inherits:
Object
  • Object
show all
Includes:
Yast::I18n
Defined in:
library/general/src/lib/y2issues/issue.rb

Overview

Represents a problem detected by YaST.

This class represents a generic error. Other classes can inherit from this one to add more specific information. See InvalidValue as an example.

Examples:

Create a new error

Issue.new("Could not read network configuration", severity: :error)

Create an error from an specific location

Issue.new(
  "Could not read the routing table",
  location: "file:/etc/sysconfig/ifroute-eth0",
  severity: :warn
)

Direct Known Subclasses

InvalidValue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, location: nil, severity: :warn) ⇒ Issue



53
54
55
56
57
# File 'library/general/src/lib/y2issues/issue.rb', line 53

def initialize(message, location: nil, severity: :warn)
  @message = message
  @location = location.is_a?(String) ? Location.parse(location) : location
  @severity = severity
end

Instance Attribute Details

#locationLocation? (readonly)



42
43
44
# File 'library/general/src/lib/y2issues/issue.rb', line 42

def location
  @location
end

#messageString (readonly)



44
45
46
# File 'library/general/src/lib/y2issues/issue.rb', line 44

def message
  @message
end

#severitySymbol (readonly)



46
47
48
# File 'library/general/src/lib/y2issues/issue.rb', line 46

def severity
  @severity
end

Instance Method Details

#error?Boolean Also known as: fatal?

Determines whether the issue is an error



62
63
64
# File 'library/general/src/lib/y2issues/issue.rb', line 62

def error?
  @severity == :error
end