4 Commits

Author SHA1 Message Date
Niklas Keller
af44670353 Improve error message for failed domain DNS 2017-01-02 00:07:23 +01:00
Niklas Keller
0bd3525938 Use 'composer update' instead of 'composer install'
We need another PHPUnit version for PHP 5.5.
2016-12-15 10:53:03 +01:00
Niklas Keller
c3f8424785 Fix tests 2016-12-15 10:35:24 +01:00
Niklas Keller
040aebe993 Improve error message on timed out MX query
Any error, not only NoRecordExceptions, resulted in a MX record not found
error message. The previous message is now only shown if there's really no
record. Otherwise a more generic message is shown now.

Fixes #43.
2016-12-14 19:21:41 +01:00
4 changed files with 15 additions and 8 deletions

View File

@@ -11,12 +11,10 @@ cache:
- vendor
install:
- phpenv config-rm xdebug.ini
- composer self-update
- phpenv config-rm xdebug.ini || true
- composer config --global discard-changes true
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.5" ]]; then composer require --dev --no-update phpunit/phpunit ^4; fi
- composer require satooshi/php-coveralls dev-master --dev --no-update
- composer update --ignore-platform-reqs
- composer update
- composer require satooshi/php-coveralls dev-master --dev
- composer show --installed
script:

View File

@@ -22,7 +22,7 @@
"symfony/yaml": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^5",
"phpunit/phpunit": "^4|^5",
"friendsofphp/php-cs-fixer": "^1.9",
"macfja/phar-builder": "^0.2.5"
},

View File

@@ -194,7 +194,13 @@ class Issue implements Command {
}
if (!empty($errors)) {
throw new AcmeException("Couldn't resolve the following domains to an IPv4 nor IPv6 record: " . implode(", ", array_keys($errors)));
$failedDomains = implode(", ", array_keys($errors));
$reasons = implode("\n\n", array_map(function ($exception) {
/** @var \Exception|\Throwable $exception */
return get_class($exception) . ": " . $exception->getMessage();
}, $errors));
throw new AcmeException("Couldn't resolve the following domains to an IPv4 nor IPv6 record: {$failedDomains}\n\n{$reasons}");
}
}

View File

@@ -3,6 +3,7 @@
namespace Kelunik\AcmeClient\Commands;
use Amp\CoroutineResult;
use Amp\Dns\NoRecordException;
use Amp\Dns\Record;
use Amp\Dns\ResolutionException;
use InvalidArgumentException;
@@ -80,8 +81,10 @@ class Setup implements Command {
try {
yield \Amp\Dns\query($host, Record::MX);
} catch (ResolutionException $e) {
} catch (NoRecordException $e) {
throw new AcmeException("No MX record defined for '{$host}'");
} catch (ResolutionException $e) {
throw new AcmeException("Dns query for an MX record on '{$host}' failed for the following reason: " . $e->getMessage(), null, $e);
}
}