Commit 61ff3fcb authored by Matěj Laitl's avatar Matěj Laitl
Browse files

MySqlEmbeddedStorage: improve error reporting in case MySQLe init fails

...previously we would emit a confusing message which could lead to
blaming MySQL devs for providing a very crazy error message
("Shutdown complete").

No functional changes in this commit.
parent b8d165de
......@@ -15,6 +15,8 @@
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#define DEBUG_PREFIX "MySqlEmbeddedStorage"
#include "MySqlEmbeddedStorage.h"
#include "core/support/Amarok.h"
......@@ -70,10 +72,16 @@ MySqlEmbeddedStorage::MySqlEmbeddedStorage( const QString &storageLocation )
dir.mkpath( "." );
}
if( mysql_library_init( mysql_args.size() , const_cast<char**>(mysql_args.data()), 0 ) != 0 )
int ret = mysql_library_init( mysql_args.size(), const_cast<char**>(mysql_args.data()), 0 );
if( ret != 0 )
{
error() << "MySQL library initialization failed.";
reportError( "init" );
// it has no sense to call reportError here because m_db is not yet initialized
QMutexLocker locker( &m_mutex );
QString errorMessage( "GREPME " + m_debugIdent + " library initialization "
"failed, return code " + QString::number( ret ) );
m_lastErrors.append( errorMessage );
error() << errorMessage.toLocal8Bit().constData();
error() << "mysqle arguments were:" << mysql_args;
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment