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

Корректное отображение ошибки CURL когда запрос не выполнился #28

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

Conversation

rtmvnv
Copy link

@rtmvnv rtmvnv commented May 27, 2022

Исправлена ситуация, когда при ошибке CURL запроса возникало исключение с пустым текстом: Curl error: .

throw new Exception('Curl error: ' . curl_error($curl));

Это происходило, потому что обрабатывались только HTTP коды 200, 202, 400, 401. При других HTTP кодах текст брался из функции curl_error(), который пуст, так как запрос прошел и CURL получил ответ от сервера.

Воспроизвести ситуацию можно задав неверное значение api_url

  $client = [
    'inn' => '0123456789',
    'api_url' => 'https://apip.orangedata.ru:2443/nothing',

@rtmvnv rtmvnv changed the title Handle correctly CURL errors when HTTP code is not set Корректное отображение ошибки CURL когда запрос не выполнился May 30, 2022
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.

None yet

1 participant