picqer / picqer-php

PHP Client for the Picqer API
https://picqer.com/en/api
MIT License
18 stars 23 forks source link

Confusing error codes #45

Open nickkraakman opened 4 months ago

nickkraakman commented 4 months ago

An example API error response would be:

404 Not Found
{ "error": true, "error_code": 8, "error_message": "Not implemented" }

This matches what is described in the docs, and returns both an HTTP status code and a Picqer specific error code.

However, the PHP Client returns does:

$result['error'] = true;
$result['errorcode'] = $headerInfo['http_code'];
$result['errormessage'] = $apiResult;

So from the docs we expected error_code, yet we got errorcode (no underscore), and we also expected this to be the Picqer specific error code, but instead it is set to the http_code from the header, so we don't have access to the Picqer specific error code at all in this response.