Command transport: Show helpful exception messages

refs #7437
This commit is contained in:
Eric Lippmann 2014-10-24 11:45:58 +02:00
parent 38220afd11
commit 12cadb52ca
1 changed files with 10 additions and 2 deletions

View File

@ -33,7 +33,10 @@ abstract class CommandTransport
if (! isset(self::$config)) { if (! isset(self::$config)) {
self::$config = Config::module('monitoring', 'instances'); self::$config = Config::module('monitoring', 'instances');
if (self::$config->count() === 0) { if (self::$config->count() === 0) {
throw new ConfigurationError; throw new ConfigurationError(
'No instances have been configured in \'%s\'.',
self::$config->getConfigFile()
);
} }
} }
return self::$config; return self::$config;
@ -58,7 +61,12 @@ abstract class CommandTransport
$transport = new LocalCommandFile(); $transport = new LocalCommandFile();
break; break;
default: default:
throw new ConfigurationError(); throw new ConfigurationError(
'Can\'t create command transport \'%s\'. Invalid transport defined in \'%s\'.'
. ' Use one of \'local\' or \'remote\'.',
$config->transport,
self::$config->getConfigFile()
);
} }
unset($config->transport); unset($config->transport);
foreach ($config as $key => $value) { foreach ($config as $key => $value) {