Exception: WebApiError
- Inherits:
-
SteamCondenserError
- Object
- StandardError
- SteamCondenserError
- WebApiError
- Defined in:
- lib/errors/web_api_error.rb
Overview
This error is raised when a Steam Web API request or a related action fails. This can have various reasons like an invalid Web API key or a broken request.
Instance Attribute Summary
Attributes inherited from SteamCondenserError
Instance Method Summary collapse
-
#initialize(cause, status_code = nil, status_message = '') ⇒ WebApiError
constructor
Creates a new ‘WebApiError` with an error message according to the given `cause`.
Constructor Details
#initialize(cause, status_code = nil, status_message = '') ⇒ WebApiError
Creates a new ‘WebApiError` with an error message according to the given `cause`. If this cause is `:status_bad` (which will origin from the Web API itself) or `:http_error` the details about this failed request will be taken from `status_code` and `status_message`.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/errors/web_api_error.rb', line 40 def initialize(cause, status_code = nil, = '') case cause when :http_error then = "The Web API request has failed due to an HTTP error: #{} (status code: #{status_code})." when :invalid_key then = 'This is not a valid Steam Web API key.' when :status_bad then = "The Web API request failed with the following error: #{} (status code: #{status_code})." when :unauthorized then = 'Your Web API request has been rejected. You most likely did not specify a valid Web API key.' else = 'An unexpected error occured while executing a Web API request.' end super end |