Sha256: f892f51c7ce08248571d37637ac628bf59441fd1bbdbb4e0c20ac2fa9545f53b
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
module Formi9 # Part1 API error # Custom error class for rescuing from all formi9.com errors class Error < StandardError attr_reader :http_method, :url, :errors def initialize(response) super @response = response.dup @http_method = response.method.to_s @url = response.url end def message <<-HEREDOC URL: #{@response.url} method: #{@response.method} response status: #{@response.status} response body: #{@response.response.body} HEREDOC end end # Raised when formi9.com returns the HTTP status code 400 class BadRequest < Error; end # Raised when formi9.com returns the HTTP status code 401 class Unauthorized < Error; end # Raised when formi9.com returns the HTTP status code 404 class NotFound < Error; end # Raised when formi9.com returns the HTTP status code 500 class InternalServerError < Error; end # Raised when formi9.com returns the HTTP status code 502 class BadGateway < Error; end # Raised when formi9.com returns the HTTP status code 503 class ServiceUnavailable < Error; end # Raised when formi9.com returns the HTTP status code 504 class GatewayTimeout < Error; end # Part2 Non-API error # Raised when client fails to provide required parameters. class MissingRequiredArgument < StandardError; end # Raised when configuration is missing class MissingRequiredConfigurationt < StandardError; end # Invalid username or password class CredentialAreInvalid < StandardError; end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
formi9-0.1.8 | lib/formi9/error.rb |
formi9-0.1.7 | lib/formi9/error.rb |