Exception: Yo_Error

Inherits:
Exception
  • Object
show all
Defined in:
lib/cli_yo/yo_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, code = nil) ⇒ Yo_Error

Returns a new instance of Yo_Error.



4
5
6
7
# File 'lib/cli_yo/yo_error.rb', line 4

def initialize error , code = nil
  @error = error
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



2
3
4
# File 'lib/cli_yo/yo_error.rb', line 2

def code
  @code
end

#errorObject (readonly)

Returns the value of attribute error.



2
3
4
# File 'lib/cli_yo/yo_error.rb', line 2

def error
  @error
end

Instance Method Details

#to_sObject



9
10
11
12
13
14
15
# File 'lib/cli_yo/yo_error.rb', line 9

def to_s
  if @code
    "Error code #{@code} => #{@error}"
  else
    @error
  end
end