Skip to content

Commit 6b96d3b

Browse files
committed
Added better exception messages
1 parent 0a28102 commit 6b96d3b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ClientFactory/GenericClientFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GenericClientFactory
2525
public function getClient($name, array $config = [])
2626
{
2727
if (!isset($this->clientFactories[$name])) {
28-
throw new \InvalidArgumentException(sprintf('No factory named %s was found. Configured factory names are: %s', $name, implode(', ', array_keys($this->clientFactories))));
28+
throw new \InvalidArgumentException(sprintf('No factory named "%s" was found. Configured factory names are: %s', $name, implode(', ', array_keys($this->clientFactories))));
2929
}
3030

3131
return $this->clientFactories[$name]->createClient($config);

DependencyInjection/HttplugExtension.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ protected function verifyDependencies($adapterName)
5959
'guzzle6'=>['package'=>'php-http/guzzle6-adapter', 'class'=>'Http\Adapter\Guzzle6HttpAdapter'],
6060
];
6161

62+
if (!isset($map[$adapterName])) {
63+
// This is none of our adapters. We have to assume the user has configured one of his own.
64+
return;
65+
}
66+
6267
if (!class_exists($map[$adapterName]['class'])) {
63-
throw new \LogicException(sprintf('In order to use %s adapter you need to install package %s', $adapterName, $map[$adapterName]['package']));
68+
throw new \LogicException(sprintf('To use the "%s" adapter you need to install the "%s" package. ', $adapterName, $map[$adapterName]['package']));
6469
}
6570
}
6671
}

0 commit comments

Comments
 (0)