Sha256: a158de3c29f109cb6f10f062c0b078d996e77c0234c282ad6da3160c945319af

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module BusinessCentral
  class BusinessCentralError < StandardError; end

  class ApiException < BusinessCentralError
    def initialize(message)
      @message = message
      super
    end

    attr_reader :message
  end

  class CompanyNotFoundException < BusinessCentralError
    def message
      'Company not found'
    end
  end

  class UnauthorizedException < BusinessCentralError
    def message
      'Unauthorized - The credentials provided are incorrect'
    end
  end

  class NotFoundException < BusinessCentralError
    def message
      'Not Found - The URL provided cannot be found'
    end
  end

  class InvalidObjectURLException < BusinessCentralError
    def message
      'Object URL missing for request'
    end
  end

  class InvalidClientException < BusinessCentralError
    def message
      'Invalid client setup'
    end
  end

  class InvalidGrantException < BusinessCentralError
    def initialize(error_message)
      @error_message = error_message
      super
    end

    attr_reader :error_message

    def message
      'The provided grant has expired due to it being revoked, a fresh auth token is needed'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
business-central-2.0.0 lib/business_central/exceptions.rb