Sha256: f6a1b705cf1217f01061f1bad7455329ffd541b7ab684ec7878055b8895d411b

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

require 'forwardable'

module Smartsheet
  class Error < StandardError; end

  # Errors for invalid requests, timeouts, etc.
  class RequestError < Error
    attr_reader :wrapped_exception

    def initialize(ex)
      super(ex.message)
      @wrapped_exception = ex
    end
  end

  class ApiError < Error
    extend Forwardable

    def initialize(error_response)
      super(error_response.message)
      @error_response = error_response
    end

    def_delegators :error_response, :error_code, :message, :ref_id, :detail

    private

    attr_reader :error_response
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smartsheet-1.0.0.beta.2 lib/smartsheet/error.rb
smartsheet-1.0.0.beta.0 lib/smartsheet/error.rb