Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
derive QgsGrass::Exception from QgsException
git-svn-id: http://svn.osgeo.org/qgis/trunk@12751 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jan 12, 2010
1 parent 84bd941 commit 2c78977
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/core/qgsexception.h
Expand Up @@ -18,6 +18,8 @@
#ifndef QGSEXCEPTION_H
#define QGSEXCEPTION_H

#include <QString>

/** \ingroup core
* Defines a qgis exception class.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/grass/qgsgrassplugin.cpp
Expand Up @@ -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" );
Expand Down Expand Up @@ -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;
}

Expand Down
10 changes: 5 additions & 5 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 * ) "" );
Expand Down
6 changes: 3 additions & 3 deletions src/providers/grass/qgsgrass.h
Expand Up @@ -23,7 +23,7 @@ extern "C"
#include <grass/form.h>
}

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

/*!
Expand All @@ -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
Expand Down

0 comments on commit 2c78977

Please sign in to comment.