8000 Handle non-json errors · Issue #29 · ConvertAPI/convertapi-library-php · GitHub
[go: up one dir, main page]

Skip to content

Handle non-json errors #29

@gufoe

Description

@gufoe

Hello, I am getting the following error:
TypeError Cannot access offset of type string on string
from the file:
lib/ConvertApi/Client.php:156

This is because the server returns a non-json string.
This case should throw an Error\Api just like a json-error.
Just add this before using the $json as an array, on line 156:
if (is_string($json)) throw new Error\Api($json);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0