Skip to content

Commit

Permalink
[Yaml] Normalize exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
romainneutron committed Aug 30, 2012
1 parent f18e004 commit 85d2214
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Exception/DumpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
*
* @api
*/
class DumpException extends \RuntimeException implements ExceptionInterface
class DumpException extends RuntimeException
{
}
2 changes: 1 addition & 1 deletion Exception/ParseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @api
*/
class ParseException extends \RuntimeException implements ExceptionInterface
class ParseException extends RuntimeException
{
private $parsedFile;
private $parsedLine;
Expand Down
23 changes: 23 additions & 0 deletions Exception/RuntimeException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Yaml\Exception;

/**
* Exception class thrown when an error occurs during parsing.
*
* @author Romain Neutron <imprec@gmail.com>
*
* @api
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
4 changes: 2 additions & 2 deletions Unescaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function unescapeCharacter($value)
*
* @return string The string with the new encoding
*
* @throws \RuntimeException if no suitable encoding function is found (iconv or mbstring)
* @throws RuntimeException if no suitable encoding function is found (iconv or mbstring)
*/
private function convertEncoding($value, $to, $from)
{
Expand All @@ -140,6 +140,6 @@ private function convertEncoding($value, $to, $from)
return iconv($from, $to, $value);
}

throw new \RuntimeException('No suitable convert encoding function (install the iconv or mbstring extension).');
throw new RuntimeException('No suitable convert encoding function (install the iconv or mbstring extension).');
}
}

0 comments on commit 85d2214

Please sign in to comment.