Skip to content

Commit

Permalink
[Form] Make exception handling consistent with other components
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Kotynia committed Apr 19, 2013
1 parent d6376c1 commit bf9382e
Show file tree
Hide file tree
Showing 45 changed files with 178 additions and 212 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Form/AbstractExtension.php
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Component\Form;

use Symfony\Component\Form\Exception\Exception;
use Symfony\Component\Form\Exception\InvalidArgumentException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;

/**
Expand Down Expand Up @@ -53,7 +53,7 @@ public function getType($name)
}

if (!isset($this->types[$name])) {
throw new Exception(sprintf('The type "%s" can not be loaded by this extension', $name));
throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension', $name));
}

return $this->types[$name];
Expand Down
32 changes: 16 additions & 16 deletions src/Symfony/Component/Form/Button.php
Expand Up @@ -65,11 +65,11 @@ public function offsetExists($offset)
*
* @param mixed $offset
*
* @throws \BadMethodCallException
* @throws BadMethodCallException
*/
public function offsetGet($offset)
{
throw new \BadMethodCallException('Buttons cannot have children.');
throw new BadMethodCallException('Buttons cannot have children.');
}

/**
Expand All @@ -80,11 +80,11 @@ public function offsetGet($offset)
* @param mixed $offset
* @param mixed $value
*
* @throws \BadMethodCallException
* @throws BadMethodCallException
*/
public function offsetSet($offset, $value)
{
throw new \BadMethodCallException('Buttons cannot have children.');
throw new BadMethodCallException('Buttons cannot have children.');
}

/**
Expand All @@ -94,11 +94,11 @@ public function offsetSet($offset, $value)
*
* @param mixed $offset
*
* @throws \BadMethodCallException
* @throws BadMethodCallException
*/
public function offsetUnset($offset)
{
throw new \BadMethodCallException('Buttons cannot have children.');
throw new BadMethodCallException('Buttons cannot have children.');
}

/**
Expand Down Expand Up @@ -126,11 +126,11 @@ public function getParent()
* @param null $type
* @param array $options
*
* @throws \BadMethodCallException
* @throws BadMethodCallException
*/
public function add($child, $type = null, array $options = array())
{
throw new \BadMethodCallException('Buttons cannot have children.');
throw new BadMethodCallException('Buttons cannot have children.');
}

/**
Expand All @@ -140,11 +140,11 @@ public function add($child, $type = null, array $options = array())
*
* @param string $name
*
* @throws \BadMethodCallException
* @throws BadMethodCallException
*/
public function get($name)
{
throw new \BadMethodCallException('Buttons cannot have children.');
throw new BadMethodCallException('Buttons cannot have children.');
}

/**
Expand All @@ -166,11 +166,11 @@ public function has($name)
*
* @param string $name
*
* @throws \BadMethodCallException
* @throws BadMethodCallException
*/
public function remove($name)
{
throw new \BadMethodCallException('Buttons cannot have children.');
throw new BadMethodCallException('Buttons cannot have children.');
}

/**
Expand All @@ -196,11 +196,11 @@ public function getErrors()
*
* @param string $modelData
*
* @throws \BadMethodCallException
* @throws BadMethodCallException
*/
public function setData($modelData)
{
throw new \BadMethodCallException('Buttons cannot have data.');
throw new BadMethodCallException('Buttons cannot have data.');
}

/**
Expand Down Expand Up @@ -288,11 +288,11 @@ public function getPropertyPath()
*
* @param FormError $error
*
* @throws \BadMethodCallException
* @throws BadMethodCallException
*/
public function addError(FormError $error)
{
throw new \BadMethodCallException('Buttons cannot have errors.');
throw new BadMethodCallException('Buttons cannot have errors.');
}

/**
Expand Down

0 comments on commit bf9382e

Please sign in to comment.