Exception: Weatherb::Error

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

Overview

Custom error class for rescuing from all Weatherb errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status_code) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
13
14
# File 'lib/weatherb/error.rb', line 8

def initialize(message, status_code)
  # Call the parent's constructor to set the message
  super(message)

  # Store the status_code in an instance variable
  @status_code = status_code
end

Instance Attribute Details

#status_codeObject (readonly)

Returns the value of attribute status_code.



6
7
8
# File 'lib/weatherb/error.rb', line 6

def status_code
  @status_code
end