Closed benbenw closed 6 years ago
Can you show us the response that you are receiving? Keep in mind that the SDK is built to support the possible responses from the REST API. If you are generating something different than it's not strange that the SDK cannot handle such responses.
That's something we have in mind BUT in case of a 500 error (Internal server error) the sdk should probably be ready to receive any body payload.
We're not asking for a specific dedicated exception, but for a sdk exception eg GlobalCollectException
or ApiException
instead of a NPE.
The response is an empty body with a 500 http status.
We will add a fix, but keep in mind that this does not warrant a hotfix release. It will be part of the next scheduled release.
Thanx We can wait. It's not a blocking problem.
The fix will include returning the same type of exception as would be thrown if there is a response body, except without the error id and error list. That means a 400 will cause a ValidationException
to be thrown, a 403 a AuthorizationException
, a 500 a GlobalCollectException
, etc.
This has been fixed in version 5.19.0.
In order to improve our application resilience, we are generating errors when calling the connect plateform. The calls are done with the connect sdk but the endpoint is a fake one. This mock endpoint returns all kinds of errors (4xx, 5xx, timeout, bad json, etc..)
Please note that those tests were made to verify our application not the sdk.
But for one of our test, the sdk is return a
NullPointerException
which is not the expected behaviour. In this case our mock returns a http status 500 with an empty body. The NPE is coming from : https://github.com/Ingenico-ePayments/connect-sdk-java/blob/e79e1d887cbe58f6fa2c8323bbc1a6d5a9c129da/src/main/java/com/ingenico/connect/gateway/sdk/java/ApiResource.java#L106as the
errorObject
is null. It raises a NPE instead of theIllegalArgumentException
After reading the documentation, we think that this error should throw a
GlobalCollectException
and not a NPE orIllegalArgumentException
.Extract from the connect documentation :