Skip to content

Commit

Permalink
Merge pull request #3 from slashliv/fix-catch_error
Browse files Browse the repository at this point in the history
Catch \Error fix
  • Loading branch information
muxx authored Sep 14, 2016
2 parents 462e28a + 76e5ffe commit ed1fdbd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Validator/Constraints/TwigSandboxValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,16 @@ public function validate($value, Constraint $constraint)
'{{ syntax_error }}' => $message,
));
}
catch (\Error $e) {
goto ex_r;
}
catch (\Exception $e) {
ex_r:
$message = mb_strlen($e->getMessage()) > 150 ? mb_substr($e->getMessage(), 0, 150) . '' : $e->getMessage();

$this->context->addViolation($constraint->message, array(
'{{ syntax_error }}' => $message,
));
}
}
}

0 comments on commit ed1fdbd

Please sign in to comment.