private function getTemplateForException(\Exception $exception) { foreach ($this->mapper as $class => $template) { if ($exception instanceof $class) { return $template; } } return null; }