Throw exception in case of error instead of show error with DebugUtility::debug
Execution of a wrong sql query only shows a debug message and dont throw an exception
$GLOBALS['TYPO3_DB']->sql_query('SELECT not_existing_field FROM pages');
In case of using a redirect after this query ($this->redirect()) the error is not shown at all
Overload the class behind $GLOBALS['TYPO3_DB'] and throw exception in case of sql error
Avoid using $GLOBALS['TYPO3_DB']. Its deprecated since TYPO3 8.5.
Use the new \TYPO3\CMS\Core\Database\ConnectionPool.
This extension might help in case you cant rewrite old stuff using $GLOBALS['TYPO3_DB'].