Skip to content

Commit

Permalink
Change minor naming
Browse files Browse the repository at this point in the history
  • Loading branch information
curquiza committed Jul 5, 2020
1 parent a77a6bf commit 13319b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions lib/meilisearch/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

module MeiliSearch
class ApiError < StandardError
attr_reader :http_code # e.g. 400, 404...
attr_reader :http_message # e.g. Bad Request, Not Found...
attr_reader :http_body # The response body received from the MeiliSearch API
attr_reader :code # The error code given by the MeiliSearch API
attr_reader :type # The error type given by the MeiliSearch API
attr_reader :link # The documentation link given by the MeiliSearch API
attr_reader :ms_message # The error message given by the MeiliSearch API
attr_reader :message # The detailed error message of this error class

alias ms_code code
alias ms_type type
alias ms_link link
attr_reader :http_code # e.g. 400, 404...
attr_reader :http_message # e.g. Bad Request, Not Found...
attr_reader :http_body # The response body received from the MeiliSearch API
attr_reader :ms_code # The error code given by the MeiliSearch API
attr_reader :ms_type # The error type given by the MeiliSearch API
attr_reader :ms_link # The documentation link given by the MeiliSearch API
attr_reader :ms_message # The error message given by the MeiliSearch API
attr_reader :message # The detailed error message of this error class

alias code ms_code
alias type ms_type
alias link ms_link

def initialize(http_code, http_message, http_body)
get_meilisearch_error_info(http_body) unless http_body.nil? || http_body.empty?
Expand Down
4 changes: 2 additions & 2 deletions lib/meilisearch/http_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def http_delete(relative_path = '')

private

def send_request(http_method, path, query_params = nil, body = nil)
def send_request(http_method, relative_path, query_params = nil, body = nil)
config = http_config(query_params, body)
begin
response = http_method.call(@base_url + path, config)
response = http_method.call(@base_url + relative_path, config)
rescue Errno::ECONNREFUSED => e
raise CommunicationError, e.message
end
Expand Down

0 comments on commit 13319b0

Please sign in to comment.