public static function listValidationErrors(BadResponseException $exception)
    {
        $response = $exception->getResponse();
        if ($response && $response->getStatusCode() === 400) {
            $response->getBody()->seek(0);
            $data = $response->json();
            if (isset($data['detail']) && is_array($data['detail'])) {
                return $data['detail'];
            }
        }

        throw $exception;
    }