Skip to content

Commit 2c78977

Browse files
author
jef
committed
derive QgsGrass::Exception from QgsException
git-svn-id: http://svn.osgeo.org/qgis/trunk@12751 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 84bd941 commit 2c78977

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/core/qgsexception.h

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#ifndef QGSEXCEPTION_H
1919
#define QGSEXCEPTION_H
2020

21+
#include <QString>
22+
2123
/** \ingroup core
2224
* Defines a qgis exception class.
2325
*/

src/plugins/grass/qgsgrassplugin.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ void QgsGrassPlugin::addVector()
337337
}
338338
catch ( QgsGrass::Exception &e )
339339
{
340-
QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open GRASS vector:\n %1" ).arg( QString::fromUtf8( e.what() ) ) );
340+
QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open GRASS vector:\n %1" ).arg( e.what() ) );
341341
}
342342

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

src/providers/grass/qgsgrass.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void GRASS_EXPORT QgsGrass::init( void )
9090
// Init GRASS libraries (required)
9191
G_no_gisinit(); // Doesn't check write permissions for mapset compare to G_gisinit("libgrass++");
9292

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

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

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

602-
// Temporarily commented because of
602+
// Temporarily commented because of
603603
// http://trac.osgeo.org/qgis/ticket/1900
604604
// http://trac.osgeo.org/gdal/ticket/3313
605-
// it can be uncommented once GDAL with patch gets depoyed (probably GDAL 1.8)
605+
// it can be uncommented once GDAL with patch gets deployed (probably GDAL 1.8)
606606
//G__setenv(( char * ) "GISDBASE", ( char * ) "" );
607607
//G__setenv(( char * ) "LOCATION_NAME", ( char * ) "" );
608608
//G__setenv(( char * ) "MAPSET", ( char * ) "" );

src/providers/grass/qgsgrass.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern "C"
2323
#include <grass/form.h>
2424
}
2525

26-
#include <stdexcept>
26+
#include "qgsexception.h"
2727
#include <QString>
2828

2929
/*!
@@ -32,9 +32,9 @@ extern "C"
3232
class QgsGrass
3333
{
3434
public:
35-
struct Exception : public std::runtime_error
35+
struct Exception : public QgsException
3636
{
37-
Exception( const std::string &msg ) : std::runtime_error( msg ) {}
37+
Exception( const QString &msg ) : QgsException( msg ) {}
3838
};
3939

4040
//! Get info about the mode

0 commit comments

Comments
 (0)