AfterShip / aftership-sdk-php

The PHP SDK of AfterShip API
65 stars 46 forks source link

Prevent Fatal Errors #46

Closed casbboy closed 4 years ago

casbboy commented 5 years ago

All I want to run is the LastCheckPoint function of the API. When the tracking number is available on Aftership, this function works excellent:

$last_check_point = new AfterShip\LastCheckPoint($key); 
$response = $last_check_point->get($provider,$number);

So easy. Works great. But, there is a catch. Woocommerce and Aftership sync can take anywhere from 3 to 12 hours. So, at times, the tracking number will not have synced over to Aftership yet. If this is the case, that same working function above throws a huge Fatal Error and breaks any page the code might reside on. Why throw a fatal error? How about just return Tracking Number does not exist or "false"?

So, this being the case, is there a function to run ahead of time to make sure tracking function does exist on Aftership, and then, if it does, run the LastCheckPoint function?

Thanks Ryan

yangyao commented 4 years ago

All I want to run is the LastCheckPoint function of the API. When the tracking number is available on Aftership, this function works excellent:

$last_check_point = new AfterShip\LastCheckPoint($key); 
$response = $last_check_point->get($provider,$number);

So easy. Works great. But, there is a catch. Woocommerce and Aftership sync can take anywhere from 3 to 12 hours. So, at times, the tracking number will not have synced over to Aftership yet. If this is the case, that same working function above throws a huge Fatal Error and breaks any page the code might reside on. Why throw a fatal error? How about just return Tracking Number does not exist or "false"?

So, this being the case, is there a function to run ahead of time to make sure tracking function does exist on Aftership, and then, if it does, run the LastCheckPoint function?

Thanks Ryan

Thanks Ryan

May I ask if you can provide your AfterShip API key, aftership email. And the wrong courier slug and tracking number, I need to reproduce the error. Our email : coke@aftership.com

yangyao commented 4 years ago

@casbboy we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

casbboy commented 4 years ago

@yangyao I tried writing to that email and it bounced back for not existing. Another email?