mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: Improved some exception handling.
This commit is contained in:
parent
0ba86971e2
commit
f83abe416c
@ -725,7 +725,7 @@ abstract class SS_Database {
|
||||
$limit = $sqlQuery->limit;
|
||||
// Pass limit as array or SQL string value
|
||||
if(is_array($limit)) {
|
||||
if(!array_key_exists('limit',$limit)) user_error('SQLQuery::limit(): Wrong format for $limit', E_USER_ERROR);
|
||||
if(!array_key_exists('limit',$limit)) throw new InvalidArgumentException('SQLQuery::limit(): Wrong format for $limit: ' . var_export($limit, true));
|
||||
|
||||
if(isset($limit['start']) && is_numeric($limit['start']) && isset($limit['limit']) && is_numeric($limit['limit'])) {
|
||||
$combinedLimit = $limit['start'] ? "$limit[limit] OFFSET $limit[start]" : "$limit[limit]";
|
||||
|
@ -480,7 +480,11 @@ class SQLQuery {
|
||||
* @return string
|
||||
*/
|
||||
function __toString() {
|
||||
try {
|
||||
return $this->sql();
|
||||
} catch(Exception $e) {
|
||||
return "<sql query>";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user