Exception: YourMembership::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/your_membership/error.rb

Overview

Custom exception for YourMembership error codes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_code, error_description) ⇒ Error

Returns a new instance of Error.

Parameters:

  • error_code (Integer)

    The Error Code

  • error_description (String)

    A Description of what the error means.

See Also:



11
12
13
14
# File 'lib/your_membership/error.rb', line 11

def initialize(error_code, error_description)
  self.error_code = error_code
  self.error_description = error_description
end

Instance Attribute Details

#error_codeInteger

The Error Code

Returns:

  • (Integer)

    the current value of error_code



5
6
7
# File 'lib/your_membership/error.rb', line 5

def error_code
  @error_code
end

#error_descriptionString

A Description of what the error means.

Returns:

  • (String)

    the current value of error_description



5
6
7
# File 'lib/your_membership/error.rb', line 5

def error_description
  @error_description
end

Instance Method Details

#to_sString

Returns A highly readable error message.

Returns:

  • (String)

    A highly readable error message.



17
18
19
# File 'lib/your_membership/error.rb', line 17

def to_s
  "Your Membership Returned An Error Code: #{error_code} With Message: #{error_description}"
end