mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
Add stack trace to SQL errors
Reload object on modify error to display the real unmodified object
This commit is contained in:
@@ -611,12 +611,12 @@ class CMDBSource
|
|||||||
catch (mysqli_sql_exception $e)
|
catch (mysqli_sql_exception $e)
|
||||||
{
|
{
|
||||||
self::LogDeadLock($e, true);
|
self::LogDeadLock($e, true);
|
||||||
throw new MySQLException('Failed to issue SQL query', array('query' => $sSql, $e));
|
throw new MySQLException('Failed to issue SQL query', ['query' => $sSql, $e, 'stack' => $e->getTraceAsString()]);
|
||||||
} finally {
|
} finally {
|
||||||
$oKPI->ComputeStats('Query exec (mySQL)', $sSql);
|
$oKPI->ComputeStats('Query exec (mySQL)', $sSql);
|
||||||
}
|
}
|
||||||
if ($oResult === false) {
|
if ($oResult === false) {
|
||||||
$aContext = array('query' => $sSql);
|
$aContext = ["\nstack" => (new Exception(''))->getTraceAsString(), "\nquery" => $sSql];
|
||||||
|
|
||||||
$iMySqlErrorNo = DbConnectionWrapper::GetDbConnection(true)->errno;
|
$iMySqlErrorNo = DbConnectionWrapper::GetDbConnection(true)->errno;
|
||||||
$aMySqlHasGoneAwayErrorCodes = MySQLHasGoneAwayException::getErrorCodes();
|
$aMySqlHasGoneAwayErrorCodes = MySQLHasGoneAwayException::getErrorCodes();
|
||||||
|
|||||||
@@ -664,6 +664,7 @@ JS;
|
|||||||
$aResult['data'] = ['error_message' => $e->getHtmlMessage()];
|
$aResult['data'] = ['error_message' => $e->getHtmlMessage()];
|
||||||
} else {
|
} else {
|
||||||
$oPage->AddHeaderMessage($e->getHtmlMessage(), 'message_error');
|
$oPage->AddHeaderMessage($e->getHtmlMessage(), 'message_error');
|
||||||
|
$oObj->Reload();
|
||||||
$oObj->DisplayModifyForm($oPage,
|
$oObj->DisplayModifyForm($oPage,
|
||||||
array('wizard_container' => true)); // wizard_container: display the wizard border and the title
|
array('wizard_container' => true)); // wizard_container: display the wizard border and the title
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user