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

Null pointer exception #21

Open
rukaelin opened this issue Apr 12, 2019 · 2 comments
Open

Null pointer exception #21

rukaelin opened this issue Apr 12, 2019 · 2 comments

Comments

@rukaelin
Copy link
Contributor

We are using your SDK and at the mentioned line, a null pointer exception occurred.
$errorResponse[0] is null, so calling a method on it fails.

parent::__construct($errorResponse[0]->getMessage(), null, $previous);

here is the stack trace:

Uncaught Error: Call to a member function getMessage() on null in ***/vendor/hyperwallet/sdk/src/Hyperwallet/Exception/HyperwalletApiException.php:26
Stack trace:
#0 ***/vendor/hyperwallet/sdk/src/Hyperwallet/Util/ApiClient.php(145): Hyperwallet\Exception\HyperwalletApiException->__construct(Object(Hyperwallet\Response\ErrorResponse), Object(GuzzleHttp\Exception\ServerException))
#1 ***/vendor/hyperwallet/sdk/src/Hyperwallet/Util/ApiClient.php(107): Hyperwallet\Util\ApiClient->doRequest('GET', '/rest/v3/transf...', Array, Array)
#2 ***/vendor/hyperwallet/sdk/src/Hyperwallet/Hyperwallet.php(1347): Hyperwallet\Util\ApiClient->doGet('/rest/v3/transf...', Array, Array)
#3
@wmews-hw
Copy link
Collaborator

Hi @rukaelin,

We could simply add a null check to avoid the error but could you help us understand the scenario providing:

  • what is the call that we are trying to make?
  • what was the http response that is causing this error?

@rukaelin
Copy link
Contributor Author

It's harder for me to tell, as it happened already more than two weeks in the past.
I think it relates to a 502 response that was sent shortly before the mentioned error:

file: gyg/vendor/hyperwallet/sdk/src/Hyperwallet/Response/ErrorResponse.php:37

msg: Undefined index: errors
context:
(
[statusCode] => 502
[errors] => array((
[error] => array((
[message] => "Bad Gateway: indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request."
[code] => "502"
)
)
)
)
)

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

No branches or pull requests

2 participants