diff --git a/Speed/Convoy.php b/Speed/Convoy.php index 4143e98..70f95f4 100644 --- a/Speed/Convoy.php +++ b/Speed/Convoy.php @@ -13,7 +13,7 @@ class Convoy extends Server { public function request($url, $method = 'get', $data = []): array { - // Trim any leading slashes from the base url and add the path URL to it + // Trim any leading slashes from the base url and add the path url to it $req_url = rtrim($this->config('host'), '/') . '/api/application/' . $url; $response = Http::withHeaders([ 'Authorization' => 'Bearer ' . $this->config('api_key'), @@ -22,11 +22,7 @@ class Convoy extends Server if (!$response->successful()) { $json = $response->json(); - if (is_array($json)) { - $message = $json['message'] ?? $json['error'] ?? $json['errors'][0]['message'] ?? 'Server Error'; - } else { - $message = 'Server Error: ' . $response->status(); - } + $message = $json['message'] ?? $json['error'] ?? 'Server Error'; throw new Exception($message); } @@ -193,8 +189,6 @@ class Convoy extends Server } catch (Exception $e) { return $e->getMessage(); } - - return true; } // Convoy is really strict (The account password must contain 8 - 50 characters, 1 uppercase, 1 lowercase, 1 number and 1 special character.)