Exception: BerkeleyLibrary::TIND::API::BaseURINotSet

Inherits:
APIException
  • Object
show all
Defined in:
lib/berkeley_library/tind/api/api_exception.rb

Overview

Exception raised when the TIND base URI is nil or blank.

Instance Attribute Summary

Attributes inherited from APIException

#params, #response, #status_code, #status_message, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIException

#body, wrap

Constructor Details

#initialize(endpoint, params) ⇒ BaseURINotSet

Returns a new instance of BaseURINotSet.

Parameters:

  • endpoint (String, Symbol)

    the endpoint

  • params (Hash, nil)

    the query parameters



113
114
115
116
# File 'lib/berkeley_library/tind/api/api_exception.rb', line 113

def initialize(endpoint, params)
  msg = BaseURINotSet.format_message(endpoint, params)
  super(msg, status_code: 404)
end

Class Method Details

.format_message(endpoint, params) ⇒ Object



119
120
121
122
123
124
125
126
# File 'lib/berkeley_library/tind/api/api_exception.rb', line 119

def format_message(endpoint, params)
  "request to endpoint #{endpoint.inspect}".tap do |msg|
    if (query_string = API.format_query(params))
      msg << " with query #{query_string}"
    end
    msg << ' failed; base URI not set'
  end
end