From 623850a281e5fda8ace9f942aa4fef8e1ecc9b3c Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser <muesli@gmail.com> Date: Thu, 31 May 2012 16:54:44 +0200 Subject: [PATCH] * Catch any exceptions when opening the lucene FSDirectory. --- src/libtomahawk/database/FuzzyIndex.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/libtomahawk/database/FuzzyIndex.cpp b/src/libtomahawk/database/FuzzyIndex.cpp index 5a6255d14..86334d5a0 100644 --- a/src/libtomahawk/database/FuzzyIndex.cpp +++ b/src/libtomahawk/database/FuzzyIndex.cpp @@ -47,8 +47,17 @@ FuzzyIndex::FuzzyIndex( bool wipeIndex ) QByteArray path = m_lucenePath.toUtf8(); const char* cPath = path.constData(); - m_luceneDir = FSDirectory::getDirectory( cPath ); - m_analyzer = _CLNEW SimpleAnalyzer(); + tDebug() << "Opening Lucene directory:" << path; + try + { + m_luceneDir = FSDirectory::getDirectory( cPath ); + m_analyzer = _CLNEW SimpleAnalyzer(); + } + catch ( CLuceneError& error ) + { + tDebug() << "Caught CLucene error:" << error.what(); + Q_ASSERT( false ); + } if ( wipeIndex ) { @@ -92,7 +101,7 @@ FuzzyIndex::beginIndexing() } catch( CLuceneError& error ) { - qDebug() << "Caught CLucene error:" << error.what(); + tDebug() << "Caught CLucene error:" << error.what(); Q_ASSERT( false ); } } @@ -160,7 +169,7 @@ FuzzyIndex::appendFields( const QMap< unsigned int, QMap< QString, QString > >& } catch( CLuceneError& error ) { - qDebug() << "Caught CLucene error:" << error.what(); + tDebug() << "Caught CLucene error:" << error.what(); Q_ASSERT( false ); } }