Module: GetYourRep::Errors

Included in:
Delegation, OfficeLocation, Representative
Defined in:
lib/get_your_rep/errors.rb

Overview

Custom Error handling classes and methods.

Defined Under Namespace

Classes: AddressError, CommandNotFoundError, GetYourRepTypeError

Instance Method Summary collapse

Instance Method Details

#address_type_errorObject

:nodoc:



61
62
63
64
65
# File 'lib/get_your_rep/errors.rb', line 61

def address_type_error # :nodoc:
  raise AddressError
rescue AddressError => error
  puts error.invalid_address_type.bold.red
end

#command_not_found_errorObject

:nodoc:



67
68
69
70
71
# File 'lib/get_your_rep/errors.rb', line 67

def command_not_found_error # :nodoc:
  raise CommandNotFoundError
rescue CommandNotFoundError => error
  puts error.command_not_found.bold.red
end

#not_a_del_errorObject

:nodoc:



49
50
51
52
53
# File 'lib/get_your_rep/errors.rb', line 49

def not_a_del_error # :nodoc:
  raise GetYourRepTypeError
rescue GetYourRepTypeError => error
  puts error.not_a_delegation
end

#not_a_rep_errorObject

:nodoc:



55
56
57
58
59
# File 'lib/get_your_rep/errors.rb', line 55

def not_a_rep_error # :nodoc:
  raise GetYourRepTypeError
rescue GetYourRepTypeError => error
  puts error.not_a_rep
end

#not_an_office_errorObject

:nodoc:



43
44
45
46
47
# File 'lib/get_your_rep/errors.rb', line 43

def not_an_office_error # :nodoc:
  raise GetYourRepTypeError
rescue GetYourRepTypeError => error
  puts error.not_an_office
end

#reps_not_found_errorObject

:nodoc:



73
74
75
76
77
# File 'lib/get_your_rep/errors.rb', line 73

def reps_not_found_error # :nodoc:
  raise AddressError
rescue AddressError => error
  puts error.reps_not_found.bold.red
end