Skip to content

Commit 34ebc5b

Browse files
authored
Merge pull request #18 from FreshMail/modification-in-exception-messages
some modification in exception messages
2 parents de5295e + fa6487f commit 34ebc5b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/FreshMail/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public function doFileRequest(string $uri, array $params = [])
101101
return $response->getBody()->getContents();
102102
} catch (\GuzzleHttp\Exception\ClientException $exception) {
103103
if ($exception->getCode() == 401) {
104-
throw new UnauthorizedException('Request unauthorized');
104+
throw new UnauthorizedException('Request unauthorized', 401);
105105
}
106106

107-
throw new \FreshMail\ApiV2\ClientException(sprintf('Connection error, error message: '.$exception->getMessage()));
107+
throw new \FreshMail\ApiV2\ClientException($exception->getMessage(), $exception->getResponse()->getStatusCode());
108108
} catch (\GuzzleHttp\Exception\ConnectException $exception) {
109-
throw new ConnectionException(sprintf('Connection error, error message: '.$exception->getMessage()));
109+
throw new ConnectionException($exception->getMessage());
110110
}
111111
}
112112

0 commit comments

Comments
 (0)