Skip to content

Commit

Permalink
Fix unexpected-status-code invocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ihsw committed Jan 1, 2018
1 parent 0a4c59c commit a3a6bc0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Toxiproxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@ public function delete(Proxy $proxy)
$this->httpClient->delete(sprintf("/proxies/%s", $proxy->getName()));
} catch (HttpClientException $e) {
switch ($e->getResponse()->getStatusCode()) {
case 404:
case self::NOT_FOUND:
throw new NotFoundException(sprintf("Proxy not found: %s", $proxy->getName()));
default:
throw new UnexpectedStatusCodeException(sprintf("Unexpected status code"), 204, $e);
throw new UnexpectedStatusCodeException(
sprintf("Unexpected status code"),
$e->getResponse()->getStatusCode(),
$e
);
}
}
}
Expand Down

0 comments on commit a3a6bc0

Please sign in to comment.