-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: adds error handling for OpenApi errors #166
Conversation
0fbea15
to
982974a
Compare
@@ -13,3 +13,5 @@ Layout/LineLength: | |||
Metrics/MethodLength: | |||
Max: 50 | |||
|
|||
Metrics/AbcSize: | |||
Max: 20 |
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 was getting linter errors that code like this was too complicated with a score of 18.79/17
passage-ruby/lib/passageidentity/user.rb
Lines 153 to 170 in 982974a
def revoke_device(user_id:, device_id:) | |
raise ArgumentError, 'user_id is required.' unless user_id && !user_id.empty? | |
raise ArgumentError, 'device_id is required.' unless device_id && !device_id.empty? | |
begin | |
@user_device_client.delete_user_devices(@app_id, user_id, device_id, @req_opts) | |
rescue OpenapiClient::ApiError => e | |
raise PassageError.new( | |
status_code: e.code, | |
body: try_parse_json_string(e.response_body) | |
) | |
rescue Faraday::Error => e | |
raise PassageError.new( | |
status_code: e.response[:status], | |
body: e.response[:body] | |
) | |
end | |
end |
but i figured that's not too bad, so adjusting this limit instead
e712cec
to
bcbdce2
Compare
lib/passageidentity/user.rb
Outdated
@@ -208,6 +211,11 @@ def revoke_refresh_tokens(user_id:) | |||
|
|||
private | |||
|
|||
def blank_str(str) |
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.
Nitpick: Ruby methods that return a boolean typically end with a question mark.
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.
Quality Gate passedIssues Measures |
What's New?
Faraday
errors, butOpenapiClient
instead''
stringScreenshots (if appropriate):
Type of change
Checklist:
Additional context