Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit b450853

Browse files
committed
Better exception message for inability to resolve service
1 parent 1173515 commit b450853

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/ServiceManager.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,7 @@ private function getFactory($name)
366366
}
367367

368368
throw new ServiceNotFoundException(sprintf(
369-
'An invalid or missing factory was given for creating service "%s". Did you make sure you added the service
370-
into the service manager configuration?',
369+
'Unable to resolve service "%s" to a factory; are you certain you provided it during configuration?',
371370
$name
372371
));
373372
}

test/CommonServiceLocatorBehaviorsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public function testPassingInvalidInitializerTypeViaConfigurationRaisesException
505505
public function testGetRaisesExceptionWhenNoFactoryIsResolved()
506506
{
507507
$serviceManager = $this->createContainer();
508-
$this->setExpectedException(ContainerException::class, 'invalid or missing factory');
508+
$this->setExpectedException(ContainerException::class, 'Unable to resolve');
509509
$serviceManager->get('Some\Unknown\Service');
510510
}
511511

0 commit comments

Comments
 (0)