Merge pull request #3686 from owncloud/minor_exception_cleanup
minor cleanup for exception handling
This commit is contained in:
commit
2a58cf8117
|
@ -568,10 +568,6 @@ class OC_DB {
|
||||||
|
|
||||||
self::raiseExceptionOnError($definition,'Failed to parse the database definition');
|
self::raiseExceptionOnError($definition,'Failed to parse the database definition');
|
||||||
|
|
||||||
// Die in case something went wrong
|
|
||||||
if( $definition instanceof MDB2_Schema_Error ) {
|
|
||||||
OC_Template::printErrorPage( $definition->getMessage().': '.$definition->getUserInfo() );
|
|
||||||
}
|
|
||||||
if(OC_Config::getValue('dbtype', 'sqlite')==='oci') {
|
if(OC_Config::getValue('dbtype', 'sqlite')==='oci') {
|
||||||
unset($definition['charset']); //or MDB2 tries SHUTDOWN IMMEDIATE
|
unset($definition['charset']); //or MDB2 tries SHUTDOWN IMMEDIATE
|
||||||
$oldname = $definition['name'];
|
$oldname = $definition['name'];
|
||||||
|
@ -921,7 +917,7 @@ class OC_DB {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* check if a result is an error, writes a log entry and throws an exception, works with MDB2 and PDOException
|
* check if a result is an error and throws an exception, works with MDB2 and PDOException
|
||||||
* @param mixed $result
|
* @param mixed $result
|
||||||
* @param string message
|
* @param string message
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -934,7 +930,7 @@ class OC_DB {
|
||||||
} else {
|
} else {
|
||||||
$message .= ', Root cause:' . self::getErrorMessage($result);
|
$message .= ', Root cause:' . self::getErrorMessage($result);
|
||||||
}
|
}
|
||||||
throw new DatabaseException($message, getErrorCode($result));
|
throw new DatabaseException($message, self::getErrorCode($result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,7 @@ class OC_Template{
|
||||||
$error_msg = '['.$exception->getCode().'] '.$error_msg;
|
$error_msg = '['.$exception->getCode().'] '.$error_msg;
|
||||||
}
|
}
|
||||||
$hint = $exception->getTraceAsString();
|
$hint = $exception->getTraceAsString();
|
||||||
while ($exception = $exception->previous()) {
|
while (method_exists($exception,'previous') && $exception = $exception->previous()) {
|
||||||
$error_msg .= '<br/>Caused by: ';
|
$error_msg .= '<br/>Caused by: ';
|
||||||
if ($exception->getCode()) {
|
if ($exception->getCode()) {
|
||||||
$error_msg .= '['.$exception->getCode().'] ';
|
$error_msg .= '['.$exception->getCode().'] ';
|
||||||
|
|
Loading…
Reference in New Issue