Skip to content

Client breaks when a NetworkException is thrown #8

@davidecarbone

Description

@davidecarbone

Whenever a call to PokeAPI returns an http code different from 200, Client attempts to throw a NetworkException, which cannot be built due to conflicts with the inherited \Exception constructor.

To reproduce:

$api = new \PokeAPI\Client();
$api->pokemon('badName')->getId();

Possible hotfix
Replace:
throw new NetworkException($url, $data);

with:
throw NetworkException::create($url, $data);

in Client.php:699

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions