smartsendio / woocommerce

Smart Send module for WooCommerce
GNU General Public License v3.0
0 stars 2 forks source link

Parse error message in edge cases #23

Closed Saggre closed 2 years ago

Saggre commented 2 years ago

Fixes a problem caused by error message being an object and being handled as a string in some edge cases https://github.com/smartsendio/woocommerce/blob/4d754e409e883d602833d103881eb62d8da9dd0f/smart-send-logistics/includes/lib/Smartsend/Client.php#L153-L184

bilfeldt commented 2 years ago

Dear @Saggre thanks for the PR.

Do you have an example of the API response that is causing this unexpected response you are mentioning?

Saggre commented 2 years ago

@bilfeldt the following API response will cause it as the message field is empty.

{
    "links": {
        "about": "https://app.smartsend.io/docs/errors/NotFoundHttpException",
        "status": "https://app.smartsend.io/status"
    },
    "id": null,
    "code": "NotFoundHttpException",
    "message": "",
    "errors": []
}
bilfeldt commented 2 years ago

Thanks for your PR @Saggre

This has been addressed on our central API and a future update to the entire API client included in this plugin will be taking place. Due to that then I will put this off for now.