8000 Catch \Throwable · src-run/symfony@893cf00 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 893cf00

Browse files
fprochazkanicolas-grekas
authored andcommitted
Catch \Throwable
1 parent 4533220 commit 893cf00

File tree

< 10000 span role="tooltip" aria-label="Collapse file tree" id="expand-button-file-tree-button" class="Tooltip__TooltipBase-sc-17tf59c-0 hWlpPn tooltipped-se">

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ public function load($resource, $type = null)
7777
} catch (\Exception $e) {
7878
$this->loading = false;
7979
throw $e;
80+
} catch (\Throwable $e) {
81+
$this->loading = false;
82+
throw $e;
8083
}
8184

8285
$this->loading = false;
@@ -85,7 +88,7 @@ public function load($resource, $type = null)
8588
if ($controller = $route->getDefault('_controller')) {
8689
try {
8790
$controller = $this->parser->parse($controller);
88-
} catch (\Exception $e) {
91+
} catch (\InvalidArgumentException $e) {
8992
// unable to optimize unknown notation
9093
}
9194

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
1919
use Symfony\Component\HttpFoundation\Request;
2020
use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager;
21+
use Symfony\Component\Routing\Exception\RouteNotFoundException;
2122
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2223

2324
/**
@@ -193,8 +194,8 @@ public function toolbarAction(Request $request, $token)
193194
$url = null;
194195
try {
195196
$url = $this->generator->generate('_profiler', array('token' => $token));
196-
} catch (\Exception $e) {
197-
// the profiler is not enabled
197+
} catch (RouteNotFoundException $e) {
198+
// the named route doesn't exist => the profiler is not enabled
198199
}
199200

200201
return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(

src/Symfony/Component/Config/Loader/FileLoader.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
108108
} catch (\Exception $e) {
109109
unset(self::$loading[$resource]);
110110
throw $e;
111+
} catch (\Throwable $e) {
112+
unset(self::$loading[$resource]);
113+
throw $e;
111114
}
112115

113116
unset(self::$loading[$resource]);

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
320320
return;
321321
}
322322

323+
throw $e;
324+
} catch (\Throwable $e) {
325+
unset($this->loading[$id]);
326+
unset($this->services[$id]);
327+
323328
throw $e;
324329
}
325330

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
461461
return;
462462
}
463463

464+
throw $e;
465+
} catch (\Throwable $e) {
466+
unset($this->loading[$id]);
467+
464468
throw $e;
465469
}
466470

src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
6464
$this->container->set('request', null, 'request');
6565
$this->container->leaveScope('request');
6666

67+
throw $e;
68+
} catch (\Throwable $e) {
69+
$this->container->set('request', null, 'request');
70+
$this->container->leaveScope('request');
71+
6772
throw $e;
6873
}
6974

0 commit comments

Comments
 (0)
0