Skip to content
Permalink
Browse files

[GRASS] catch fatal error when opening db

  • Loading branch information
blazek committed Aug 24, 2015
1 parent c078ce5 commit d594a56f3759f33b5ba77e20765fcfbc979191ad
Showing with 12 additions and 3 deletions.
  1. +12 −3 src/providers/grass/qgsgrassprovider.cpp
@@ -517,12 +517,21 @@ void QgsGrassProvider::loadAttributes( GLAYER &layer )
else
{
QgsDebugMsg( "Field info found -> open database" );
dbDriver *databaseDriver = db_start_driver_open_database( layer.fieldInfo->driver,
layer.fieldInfo->database );
dbDriver *databaseDriver = 0;
QString error = QString( "Cannot open database %1 by driver %2" ).arg( layer.fieldInfo->database ).arg( layer.fieldInfo->driver );
G_TRY
{
databaseDriver = db_start_driver_open_database( layer.fieldInfo->driver,
layer.fieldInfo->database );
}
G_CATCH( QgsGrass::Exception &e )
{
QgsGrass::warning( error + " : " + e.what() );
}

if ( !databaseDriver )
{
QgsDebugMsg( QString( "Cannot open database %1 by driver %2" ).arg( layer.fieldInfo->database ).arg( layer.fieldInfo->driver ) );
QgsDebugMsg( error );
}
else
{

0 comments on commit d594a56

Please sign in to comment.
You can’t perform that action at this time.