Sha256: fe40f8203ce81f53500e8c18fef784dd15cae0335b82be77cb9856df32568c5c
Contents?: true
Size: 951 Bytes
Versions: 1
Compression:
Stored size: 951 Bytes
Contents
# frozen_string_literal: true module Ki class ApiError < StandardError #:nodoc: extend Descendants attr_reader :status def initialize(body = nil, status = 400) super body.nil? ? to_s : body @status = status end def result { 'error' => to_s, 'status' => @status } end end class InvalidUrlError < ApiError #:nodoc: end class RequiredAttributeMissing < ApiError #:nodoc: end class AttributeNotUnique < ApiError #:nodoc: end class ForbiddenAction < ApiError #:nodoc: def initialize(s = 'forbidden', code = 403) super s, code end end class UnauthorizedError < ApiError #:nodoc: def initialize(s = 'unauthroized', code = 401) super s, code end end class PartialNotFoundError < ApiError #:nodoc: def initialize(s = '"partial"') super "partial #{s} not found", 404 end end end class CustomError < Ki::ApiError end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ki-0.4.12 | lib/ki/utils/api_error.rb |