Codexshaper / laravel-woocommerce

WooCommerce Rest API for Laravel
MIT License
198 stars 57 forks source link

Error tracing, No way to identify JSON errors #117

Open bretoreta opened 2 days ago

bretoreta commented 2 days ago

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);
        }
    }