Throw better Exceptions

This commit is contained in:
Phill Sparks
2011-11-15 12:35:04 +00:00
parent d643ec97dc
commit 58638216e8
23 changed files with 53 additions and 53 deletions

View File

@@ -52,7 +52,7 @@ class SQLite extends Connector {
return new PDO('sqlite:'.$config['database'], null, null, $options);
}
throw new \Exception("SQLite database [{$config['database']}] could not be found.");
throw new \OutOfBoundsException("SQLite database [{$config['database']}] could not be found.");
}
}
}

View File

@@ -18,7 +18,7 @@ class Hydrator {
{
if ( ! method_exists($eloquent, $include))
{
throw new \Exception("Attempting to eager load [$include], but the relationship is not defined.");
throw new \LogicException("Attempting to eager load [$include], but the relationship is not defined.");
}
static::eagerly($eloquent, $results, $include);
@@ -209,4 +209,4 @@ class Hydrator {
}
}
}
}

View File

@@ -38,7 +38,7 @@ class Manager {
if (is_null($config))
{
throw new \Exception("Database connection is not defined for connection [$connection].");
throw new \OutOfBoundsException("Database connection is not defined for connection [$connection].");
}
static::$connections[$connection] = new Connection(static::connect($config), $config);
@@ -88,7 +88,7 @@ class Manager {
return new Connectors\Postgres;
default:
throw new \Exception("Database driver [$driver] is not supported.");
throw new \DomainException("Database driver [$driver] is not supported.");
}
}
@@ -127,4 +127,4 @@ class Manager {
return call_user_func_array(array(static::connection(), $method), $parameters);
}
}
}

View File

@@ -669,7 +669,7 @@ class Query {
}
}
throw new \Exception("Method [$method] is not defined on the Query class.");
throw new \BadMethodCallException("Method [$method] is not defined on the Query class.");
}
}
}