@@ -414,20 +414,26 @@ private function completeException(\Exception $e, Definition $def): ServiceCreat
414
414
{
415
415
if ($ e instanceof ServiceCreationException && Strings::startsWith ($ e ->getMessage (), "Service ' " )) {
416
416
return $ e ;
417
+ }
418
+
419
+ $ name = $ def ->getName ();
420
+ $ type = $ def ->getType ();
421
+ if ($ name && !ctype_digit ($ name )) {
422
+ $ message = "Service ' $ name' " . ($ type ? " (type of $ type) " : '' ) . ': ' ;
423
+ } elseif ($ type ) {
424
+ $ message = "Service of type $ type: " ;
425
+ } elseif ($ def instanceof Definitions \ServiceDefinition && $ def ->getEntity ()) {
426
+ $ message = 'Service ( ' . $ this ->entityToString ($ def ->getEntity ()) . '): ' ;
417
427
} else {
418
- $ name = $ def ->getName ();
419
- $ type = $ def ->getType ();
420
- if (!$ type ) {
421
- $ message = "Service ' $ name': " . $ e ->getMessage ();
422
- } elseif (!$ name || ctype_digit ($ name )) {
423
- $ message = "Service of type $ type: " . str_replace ("$ type:: " , '' , $ e ->getMessage ());
424
- } else {
425
- $ message = "Service ' $ name' (type of $ type): " . str_replace ("$ type:: " , '' , $ e ->getMessage ());
426
- }
427
- return $ e instanceof ServiceCreationException
428
- ? $ e ->setMessage ($ message )
429
- : new ServiceCreationException ($ message , 0 , $ e );
428
+ $ message = '' ;
430
429
}
430
+ $ message .= $ type
431
+ ? str_replace ("$ type:: " , '' , $ e ->getMessage ())
432
+ : $ e ->getMessage ();
433
+
434
+ return $ e instanceof ServiceCreationException
435
+ ? $ e ->setMessage ($ message )
436
+ : new ServiceCreationException ($ message , 0 , $ e );
431
437
}
432
438
433
439
0 commit comments