class Starwars::Error

Custom error class for rescuing from all Starwars errors

Public Class Methods

errors() click to toggle source

Return a hash of error classes @return [Hash] @example get the total number of pages

Starwars::Error.errors

@api public

# File lib/starwars/error.rb, line 10
def errors
  @errors ||=  {
    400 => Starwars::Error::BadRequest,
    401 => Starwars::Error::Unauthorized,
    403 => Starwars::Error::Forbidden,
    404 => Starwars::Error::NotFound,
    500 => Starwars::Error::InternalServerError,
    503 => Starwars::Error::ServiceUnavailableError
  }
end
new(message = '', _status = nil) click to toggle source

Initializes a new Error object

@param message [Exception, String] @param _status [Exception, status] @return [Starwars::Error] @example

Starwars::Error.new('I am your father', nil)

@api public

Calls superclass method
# File lib/starwars/error.rb, line 30
def initialize(message = '', _status = nil)
  super(message)
end