laravel-woocommerce icon indicating copy to clipboard operation
laravel-woocommerce copied to clipboard

Error tracing, No way to identify JSON errors

Open bretoreta opened this issue 1 year ago • 0 comments

As is, whenever an error happens with Woocommerce api request the package just returns a plain JSON error message, no context for the error and no way to even identify what went wrong. Please implement the methods to return the whole context of the error not just the message

public function getRequest()
    {
        try {
            return $this->client->http->getRequest();
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage(), 1);
        }
    }

Refractor to

public function getRequest()
    {
        try {
            return $this->client->http->getRequest();
        } catch (\Exception $e) {
            throw new \Exception($e, 1);
        }
    }

bretoreta avatar Nov 21 '24 09:11 bretoreta