diff --git a/README.md b/README.md index 13c9492..0a112ec 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,11 @@ $response = $command ->run() ; -if ($response->isSuccessful()) { +// Check if the command failed and get the error if needed +if ($response->hasFailed()) { + throw new Exception('An error occurred:'.$response->getError()); +} +else { // If it has not failed, then we simply send it to the buffer header('Content-type: image/gif'); echo file_get_contents('logo.gif'); @@ -109,9 +113,14 @@ $response = $command ->run() ; -if ($response->isSuccessful()) { - header('Content-type: image/jpeg'); - echo file_get_contents('background.jpeg'); +// Check if the command failed and get the error if needed +if ($response->hasFailed()) { + throw new Exception('An error occurred:'.$response->getError()); +} +else { + // If it has not failed, then we simply send it to the buffer + header('Content-type: image/gif'); + echo file_get_contents('logo.gif'); } ```