Exception: Cli_Yo::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.



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

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

#errorObject (readonly)

Returns the value of attribute error.



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

def error
  @error
end

Instance Method Details

#to_sObject



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

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