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

Throw an exception instead of an empty list return #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tschallacka
Copy link

https://github.com/dpdconnect/php-sdk/blob/master/src/Common/ResourceClient.php#L87

uses list($status, $response). When an error is returned from dpd api, the entire shipping backend crashes, as an array index of 0 does not exist on an empty array.

By transforming the exception to a DpdException it gets caught by

} catch (DpdException $e) {
and gets handled properly by returning a cached instance.

And the magento2 shipping configuration page works.

https://github.com/dpdconnect/php-sdk/blob/master/src/Common/ResourceClient.php#L87

uses list($status, $response). When an error is returned from dpd api, the entire shipping backend crashes, as an array index of 0 does not exist on an empty array.

By transforming the exception to a DpdException it gets caught by https://github.com/dpdconnect/php-sdk/blob/12cabc0e204c56e5e9a7ff1fdde4492810cce6a2/src/Resources/Product.php#L34 and gets handled properly by returning a cached instance.

And the magento2 shipping configuration page works.
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.

1 participant