Skip to content

Commit

Permalink
Catch \Throwable
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka authored and nicolas-grekas committed May 30, 2016
1 parent 4533220 commit 893cf00
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
Expand Up @@ -77,6 +77,9 @@ public function load($resource, $type = null)
} catch (\Exception $e) {
$this->loading = false;
throw $e;
} catch (\Throwable $e) {
$this->loading = false;
throw $e;
}

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

Expand Down
Expand Up @@ -18,6 +18,7 @@
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
Expand Down Expand Up @@ -193,8 +194,8 @@ public function toolbarAction(Request $request, $token)
$url = null;
try {
$url = $this->generator->generate('_profiler', array('token' => $token));
} catch (\Exception $e) {
// the profiler is not enabled
} catch (RouteNotFoundException $e) {
// the named route doesn't exist => the profiler is not enabled
}

return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Config/Loader/FileLoader.php
Expand Up @@ -108,6 +108,9 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
} catch (\Exception $e) {
unset(self::$loading[$resource]);
throw $e;
} catch (\Throwable $e) {
unset(self::$loading[$resource]);
throw $e;
}

unset(self::$loading[$resource]);
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/DependencyInjection/Container.php
Expand Up @@ -320,6 +320,11 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
return;
}

throw $e;
} catch (\Throwable $e) {
unset($this->loading[$id]);
unset($this->services[$id]);

throw $e;
}

Expand Down
Expand Up @@ -461,6 +461,10 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
return;
}

throw $e;
} catch (\Throwable $e) {
unset($this->loading[$id]);

throw $e;
}

Expand Down
Expand Up @@ -64,6 +64,11 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
$this->container->set('request', null, 'request');
$this->container->leaveScope('request');

throw $e;
} catch (\Throwable $e) {
$this->container->set('request', null, 'request');
$this->container->leaveScope('request');

throw $e;
}

Expand Down

0 comments on commit 893cf00

Please sign in to comment.