Skip to content

feat: Add error handling for incorrect destination configuration in HttpClientWrapper - #112

Merged
CharlesDuboisSAP merged 15 commits into
mainfrom
320-proxyhandler-throws
Nov 3, 2023
Merged

CharlesDuboisSAP merged 15 commits into
mainfrom
320-proxyhandler-throws

Conversation

@CharlesDuboisSAP

@CharlesDuboisSAP CharlesDuboisSAP commented Nov 1, 2023 •

Copy link
Copy Markdown
Contributor

Pull Request Description 🤖

This PR addresses the backlog item #320 and introduces a new feature to the HttpClientWrapper class in the connectivity-apache-httpclient4 module.

Changes

The changes in this PR include:

  • A new block of code in the HttpClientWrapper constructor that checks if the destination is configured correctly. If the destination is not configured correctly, it throws a DestinationAccessException with an appropriate error message.

The new block of code checks if the destination's PROXY_TYPE is ON_PREMISE and if the PROXY_HOST is empty. If these conditions are met, it further checks if the TENANT_ID is empty (indicating a provider) and if the AUTH_TYPE (or AUTH_TYPE_FALLBACK) is BASIC_AUTHENTICATION. If these conditions are met, it throws a DestinationAccessException with the message "Accessing an onpremise system on behalf of the provider tenant explicitly is currently not supported." Otherwise, it throws a DestinationAccessException with the message "Unable to resolve connectivity service binding."

Context

This change is part of the effort to migrate the DwC Spring E2E Test, as described in the backlog item. The new feature ensures that the destination is configured correctly before attempting to establish a connection, which helps prevent errors during runtime.

Reviewer Instructions

Please review the changes in the context of the associated backlog item. Pay particular attention to the new error handling code and ensure that it aligns with the expected behavior described in the backlog item.

@CharlesDuboisSAP CharlesDuboisSAP self-assigned this Nov 1, 2023

@Johannes-Schneider Johannes-Schneider left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do have some concerns about the suggested solution (see comments).

Furthermore, personally, I think it's a pretty big design flaw to not have the two concerns of (1) I want to connect to a remote system and (2) I want to see how my destination in the Destination Service is configured (i.e. I just need the properties) separated.
With this flaw existing, I don't see a good solution to the problem we are facing.
The only somewhat viable solutions seems to be to store the original exception within the Destination object so that it can be thrown at a later point in time, which is pretty hacky and ugly overall IMO.

@CharlesDuboisSAP

CharlesDuboisSAP commented Nov 2, 2023 •

Copy link
Copy Markdown
Contributor Author

I agree, the two different use cases (reading properties and using the destination) for the same class is a design flaw. But with the timeframe that we have to release v4, I would accept it as tech debt and have usable exceptions messages.
@Johannes-Schneider Do you think the latest commit is better than storing the exception (or the try)?

@CharlesDuboisSAP CharlesDuboisSAP added please merge Request to merge a pull request please review Request to review a pull request labels Nov 2, 2023
@CharlesDuboisSAP
CharlesDuboisSAP enabled auto-merge (squash) November 2, 2023 13:46
CharlesDuboisSAP and others added 3 commits November 3, 2023 09:33
…/cloud/sdk/cloudplatform/connectivity/DefaultHttpDestination.java

Co-authored-by: Johannes Schneider <johannes-schneider_1995@web.de>
…m/sap/cloud/sdk/cloudplatform/connectivity/HttpClientWrapper.java

Co-authored-by: Johannes Schneider <johannes-schneider_1995@web.de>
…/cloud/sdk/cloudplatform/connectivity/DefaultHttpDestination.java

Co-authored-by: Alexander Dümont <22489773+newtork@users.noreply.github.com>
newtork
newtork previously approved these changes Nov 3, 2023
newtork
newtork previously approved these changes Nov 3, 2023
…/cloud/sdk/cloudplatform/connectivity/DefaultHttpDestination.java

Co-authored-by: Johannes Schneider <johannes-schneider_1995@web.de>
@CharlesDuboisSAP
CharlesDuboisSAP enabled auto-merge (squash) November 3, 2023 11:43
@CharlesDuboisSAP
CharlesDuboisSAP merged commit 8380a95 into main Nov 3, 2023
@CharlesDuboisSAP
CharlesDuboisSAP deleted the 320-proxyhandler-throws branch November 3, 2023 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please merge Request to merge a pull request please review Request to review a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants