New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error handler #65
Conversation
44f7d12
to
a77a6bf
Compare
13319b0
to
48ccb90
Compare
1cfc406
to
08ac4a5
Compare
Co-authored-by: Thomas Payet <thomas@meilisearch.com>
Co-authored-by: Thomas Payet <thomas@meilisearch.com>
b6bb12c
to
b870f4c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work and tests! Thanks!
Why are you using simple error naming? Shouldn't we use the naming chosen here instead of simplifying it?
e.g.
ApiError
-> MeiliSearchApiError
CommunicationError
-> MeiliSearchCommunicationError
TimeoutError
-> MeiliSearchTimeoutError
@details = details | ||
|
||
def initialize(message) | ||
@message = "An error occurred while trying to connect to the MeiliSearch instance: #{message}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@message = "An error occurred while trying to connect to the MeiliSearch instance: #{message}" | |
@message = "An error occurred while trying to connect to MeiliSearch: #{message}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to make a real difference between the MeiliSearch search-engine/API/instance and the package the user is currently using that is also named "meilisearch" @eskombro
What do you suggest then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Because ruby allows namespaces. When the users will do a begin/rescue (try/catch equivalent), they will write I've already explained all of these in the issue you linked in the
And I don't need to write the namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
* Use the new error handler of MeiliSearch API * Improve the tests to check MS code and type * Add comments * Fix linter errors * Add MeiliSearch::CommunicationError * Upd rubocop_todo * Remove useless byebug * Change minor naming * Remove useless error in get_index * Update lib/meilisearch/error.rb Co-authored-by: Thomas Payet <thomas@meilisearch.com> * Update lib/meilisearch/error.rb Co-authored-by: Thomas Payet <thomas@meilisearch.com> Co-authored-by: Thomas Payet <thomas@meilisearch.com>
Related to this issue meilisearch/integration-guides#19 and the new error handler available since the MeiliSearch
v0.11.0
How to do a quick check
masterKey
as master key)test
as UID$ bundle exec ruby test.rb
wheretest.rb
is: