Skip to content

Commit

Permalink
#27 use unique Exception for CURL errors. Changed AdyenException to C…
Browse files Browse the repository at this point in the history
…onnectionException for empty result from API result
  • Loading branch information
rikterbeek committed Jun 26, 2017
1 parent 538f1e5 commit 24d1500
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Adyen/ConnectionException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Adyen;

use Exception;

class ConnectionException extends Exception
{

}
2 changes: 1 addition & 1 deletion src/Adyen/HttpClient/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protected function handleCurlError($url, $errno, $message, $logger)
}
$msg .= "\n(Network error [errno $errno]: $message)";
$logger->error($msg);
throw new \Adyen\AdyenException($msg);
throw new \Adyen\ConnectionException($msg);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function testExceptionMissingUsernamePassword()
}

// check if exception is correct
$this->assertEquals('Adyen\AdyenException', get_class($e));
$this->assertEquals('Adyen\ConnectionException', get_class($e));
$this->assertEquals("Probably your Web Service username and/or password is incorrect\n(Network error [errno 0]: )", $e->getMessage());
$this->assertEquals('0', $e->getCode());
}
Expand Down

0 comments on commit 24d1500

Please sign in to comment.