{
$this->message = $this->rawMessage;
+ $dot = false;
+ if ('.' === substr($this->message, -1)) {
+ $this->message = substr($this->message, 0, -1);
+ $dot = true;
+ }
+
if (null !== $this->filename) {
$this->message .= sprintf(' in %s', json_encode($this->filename));
}
if ($this->lineno >= 0) {
$this->message .= sprintf(' at line %d', $this->lineno);
}
+
+ if ($dot) {
+ $this->message .= '.';
+ }
}
protected function findTemplateInfo(Exception $e)
} catch (Twig_Error $e) {
throw $e;
} catch (Exception $e) {
- throw new Twig_Error_Runtime($e->getMessage(), -1, null, $e);
+ throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, null, $e);
}
}
$this->fail();
} catch (Twig_Error_Runtime $e) {
- $this->assertEquals('Runtime error... in "index" at line 4', $e->getMessage());
+ $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index" at line 4.', $e->getMessage());
$this->assertEquals(4, $e->getTemplateLine());
$this->assertEquals('index', $e->getTemplateFile());
}