Class: Releaseko::CustomError

Inherits:
Object
  • Object
show all
Defined in:
lib/releaseko/custom_error.rb

Overview

Custom Error object for Releaseko

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = 1) ⇒ CustomError

Returns a new instance of CustomError.



8
9
10
11
# File 'lib/releaseko/custom_error.rb', line 8

def initialize(message, code = 1)
  @message = message
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/releaseko/custom_error.rb', line 6

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



6
7
8
# File 'lib/releaseko/custom_error.rb', line 6

def message
  @message
end

Instance Method Details

#complainObject



13
14
15
16
# File 'lib/releaseko/custom_error.rb', line 13

def complain
  puts "Error occurred!\n#{message}\nExit code #{code}"
  exit(code)
end