Repository navigation
feat: Add error handling for incorrect destination configuration in HttpClientWrapper - #112
Conversation
There was a problem hiding this comment.
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.
|
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. |
…/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>
comments applied
…/cloud/sdk/cloudplatform/connectivity/DefaultHttpDestination.java Co-authored-by: Alexander Dümont <22489773+newtork@users.noreply.github.com>
…/cloud/sdk/cloudplatform/connectivity/DefaultHttpDestination.java Co-authored-by: Johannes Schneider <johannes-schneider_1995@web.de>
Pull Request Description 🤖
This PR addresses the backlog item #320 and introduces a new feature to the
HttpClientWrapperclass in theconnectivity-apache-httpclient4module.Changes
The changes in this PR include:
HttpClientWrapperconstructor that checks if the destination is configured correctly. If the destination is not configured correctly, it throws aDestinationAccessExceptionwith an appropriate error message.The new block of code checks if the destination's
PROXY_TYPEisON_PREMISEand if thePROXY_HOSTis empty. If these conditions are met, it further checks if theTENANT_IDis empty (indicating a provider) and if theAUTH_TYPE(orAUTH_TYPE_FALLBACK) isBASIC_AUTHENTICATION. If these conditions are met, it throws aDestinationAccessExceptionwith the message "Accessing an onpremise system on behalf of the provider tenant explicitly is currently not supported." Otherwise, it throws aDestinationAccessExceptionwith 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.