Skip to content
Permalink
Browse files

derive QgsGrass::Exception from QgsException

git-svn-id: http://svn.osgeo.org/qgis/trunk@12751 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Jan 12, 2010
1 parent 84bd941 commit 2c789779d14bffdbc9d4425155ea9e583d5dcc05
@@ -18,6 +18,8 @@
#ifndef QGSEXCEPTION_H
#define QGSEXCEPTION_H

#include <QString>

/** \ingroup core
* Defines a qgis exception class.
*/
@@ -337,7 +337,7 @@ void QgsGrassPlugin::addVector()
}
catch ( QgsGrass::Exception &e )
{
QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open GRASS vector:\n %1" ).arg( QString::fromUtf8( e.what() ) ) );
QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open GRASS vector:\n %1" ).arg( e.what() ) );
}

qGisInterface->addVectorLayer( uri, name, "grass" );
@@ -502,7 +502,7 @@ void QgsGrassPlugin::newVector()
catch ( QgsGrass::Exception &e )
{
QMessageBox::warning( 0, tr( "Warning" ),
tr( "Cannot create new vector: %1" ).arg( QString::fromUtf8( e.what() ) ) );
tr( "Cannot create new vector: %1" ).arg( e.what() ) );
return;
}

@@ -90,7 +90,7 @@ void GRASS_EXPORT QgsGrass::init( void )
// Init GRASS libraries (required)
G_no_gisinit(); // Doesn't check write permissions for mapset compare to G_gisinit("libgrass++");

// I think that mask should not be used in QGIS as it can only confuse people,
// I think that mask should not be used in QGIS as it can only confuses people,
// anyway, I don't think anybody is using MASK
G_suppress_masking();

@@ -397,8 +397,8 @@ int QgsGrass::error_routine( const char *msg, int fatal )

if ( fatal )
{
// we have to do a long jump here, otherwise GRASS >= 6.3 will kill our process
throw QgsGrass::Exception( msg );
// we have to throw an exception here, otherwise GRASS >= 6.3 will kill our process
throw QgsGrass::Exception( QString::fromUtf8( msg ) );
}
else
lastError = WARNING;
@@ -599,10 +599,10 @@ QString QgsGrass::closeMapset( )
// Reinitialize GRASS
G__setenv(( char * ) "GISRC", ( char * ) "" );

// Temporarily commented because of
// Temporarily commented because of
// http://trac.osgeo.org/qgis/ticket/1900
// http://trac.osgeo.org/gdal/ticket/3313
// it can be uncommented once GDAL with patch gets depoyed (probably GDAL 1.8)
// it can be uncommented once GDAL with patch gets deployed (probably GDAL 1.8)
//G__setenv(( char * ) "GISDBASE", ( char * ) "" );
//G__setenv(( char * ) "LOCATION_NAME", ( char * ) "" );
//G__setenv(( char * ) "MAPSET", ( char * ) "" );
@@ -23,7 +23,7 @@ extern "C"
#include <grass/form.h>
}

#include <stdexcept>
#include "qgsexception.h"
#include <QString>

/*!
@@ -32,9 +32,9 @@ extern "C"
class QgsGrass
{
public:
struct Exception : public std::runtime_error
struct Exception : public QgsException
{
Exception( const std::string &msg ) : std::runtime_error( msg ) {}
Exception( const QString &msg ) : QgsException( msg ) {}
};

//! Get info about the mode

0 comments on commit 2c78977

Please sign in to comment.