smsapi / smsapi-php-client

SMSAPI PHP client that allows you to send messages, manage Short URLs and administrate your SMSAPI account.
https://www.smsapi.pl
Other
64 stars 39 forks source link

TypeError exception #85

Closed paulogliwa closed 4 years ago

paulogliwa commented 4 years ago

A couple days ago our sentry logged the following exception:

TypeError

Return value of Smsapi\Client\Infrastructure\ResponseMapper\ApiErrorException::getError() must be of the type string, null returned

The code that produced this exception:

try {
    $sms = SendSmsBag::withMessage($params['phone'], $params['message']);
    $sms->from = $params['sender'];

    $response = $this->smsapiPlService->smsFeature()->sendSms($sms);
    $return = $response->status;
} catch (ApiErrorException $e) {
    return $e->getError();
}

What can we do to avoid this situation in the future? Isn't this a bug in your library?