Skip to content
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 message for client configuration failures #373

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

RDPerera
Copy link
Member

Copy link
Contributor

@NipunaRanasinghe NipunaRanasinghe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RDPerera Shall we add negative test(s) to cover these client init error scenarios?

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 70.58824% with 5 lines in your changes missing coverage. Please review.

Project coverage is 74.11%. Comparing base (3a2df81) to head (28b108b).
Report is 6 commits behind head on 2201.8.x.

Files with missing lines Patch % Lines
ballerina/modules/bulk/client.bal 75.00% 2 Missing ⚠️
ballerina/modules/soap/client.bal 71.42% 2 Missing ⚠️
ballerina/client.bal 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           2201.8.x     #373      +/-   ##
============================================
+ Coverage     74.03%   74.11%   +0.08%     
============================================
  Files            14       14              
  Lines          1186     1182       -4     
  Branches        713      709       -4     
============================================
- Hits            878      876       -2     
+ Misses          308      306       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@RDPerera
Copy link
Member Author

@RDPerera Shall we add negative test(s) to cover these client init error scenarios?

Due to the urgency of the patch, Shall we do it in a separate PR. Created a issue to track it separately.

@NipunaRanasinghe NipunaRanasinghe merged commit 28bf740 into 2201.8.x Nov 21, 2024
2 of 4 checks passed
Comment on lines +49 to +51
httpHandlerResult = new http:ClientOAuth2Handler(auth);
} else {
return error(INVALID_CLIENT_CONFIG);
httpHandlerResult = new http:ClientBearerTokenAuthHandler(auth);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ClientOAuth2Provider initialization, we panic[1]. So, we need to trap the error.

  1. https://github.com/ballerina-platform/module-ballerina-oauth2/blob/master/ballerina/client_oauth2_provider.bal#L207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants