Throw better Exceptions
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user