class MeiliSearch::ApiError

Attributes

code[R]

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

http_body[R]

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

http_code[R]

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

http_message[R]

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

message[R]

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

ms_code[R]

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

ms_message[R]

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

ms_type[R]

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

type[R]

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

Public Class Methods

new(http_code, http_message, http_body) click to toggle source
Calls superclass method
# File lib/meilisearch/error.rb, line 20
def initialize(http_code, http_message, http_body)
  get_meilisearch_error_info(http_body) unless http_body.nil? || http_body.empty?
  @http_code = http_code
  @http_message = http_message
  @ms_message ||= 'MeiliSearch API has not returned any error message'
  @ms_link ||= '<no documentation link found>'
  @message = "#{http_code} #{http_message} - #{@ms_message}. See #{ms_link}."
  super(details)
end

Public Instance Methods

details() click to toggle source
# File lib/meilisearch/error.rb, line 38
def details
  "MeiliSearch::ApiError - code: #{@ms_code} - type: #{ms_type} - message: #{@ms_message} - link: #{ms_link}"
end
get_meilisearch_error_info(http_body) click to toggle source
# File lib/meilisearch/error.rb, line 30
def get_meilisearch_error_info(http_body)
  @http_body = JSON.parse(http_body)
  @ms_code = @http_body['errorCode']
  @ms_message = @http_body['message']
  @ms_type = @http_body['errorType']
  @ms_link = @http_body['errorLink']
end