InterNetX / php-domainrobot-sdk

A composer package for easy integration of the Domainrobot API powered by InterNetX GmbH.
MIT License
19 stars 12 forks source link

Exception messages not passing to public api #35

Closed maxheyer closed 2 years ago

maxheyer commented 2 years ago

Hi, since the DomainrobotService does not pass messages from thrown exceptions, it is not easy to debug any errors responded by the api.

The sdk should pass any exception message to the public api.

I am likely to create a pull request to fix the described issue.

I would suggest the to reuse the message from the previous exception instead of "Domainrobot Error" in src/Service/DomainrobotService.php:

Line 128

throw new DomainrobotException($contents, $exception->getResponse()->getStatusCode(), "Domainrobot Error");

TO

throw new DomainrobotException($contents, $exception->getResponse()->getStatusCode(), $exception->getMessage());

Line 133

throw new DomainrobotException($msg, $exception->getCode(), "Domainrobot Error");

TO

throw new DomainrobotException($msg, $exception->getCode(), $exception->getMessage());
ChripIX commented 2 years ago

Hi, thanks for your input. We've added the requested changes to the SDK. Hopefully it's now easier to debug the API.

If you have further questions we're happy to help.