Skip to content

[Form] Make exception handling consistent with other components #7706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Symfony/Component/Form/AbstractExtension.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading