Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
log more error messages
  • Loading branch information
jef-n committed Nov 25, 2011
1 parent 61e0065 commit 5543a89
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
11 changes: 6 additions & 5 deletions src/core/qgsdistancearea.cpp
Expand Up @@ -28,6 +28,7 @@
#include "qgsdistancearea.h"
#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"

// MSVC compiler doesn't have defined M_PI in math.h
#ifndef M_PI
Expand Down Expand Up @@ -101,7 +102,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
myResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase );
if ( myResult )
{
QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
QgsMessageLog::logMessage( QObject::tr( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
// XXX This will likely never happen since on open, sqlite creates the
// database if it does not exist.
return false;
Expand Down Expand Up @@ -363,7 +364,7 @@ double QgsDistanceArea::measureLine( const QList<QgsPoint>& points )
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsLogger::warning( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate line length." ) );
QgsMessageLog::logMessage( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate line length." ) );
return 0.0;
}

Expand All @@ -388,7 +389,7 @@ double QgsDistanceArea::measureLine( const QgsPoint& p1, const QgsPoint& p2 )
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsLogger::warning( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate line length." ) );
QgsMessageLog::logMessage( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate line length." ) );
return 0.0;
}
}
Expand Down Expand Up @@ -476,7 +477,7 @@ unsigned char* QgsDistanceArea::measurePolygon( unsigned char* feature, double*
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsLogger::warning( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area or perimeter." ) );
QgsMessageLog::logMessage( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area or perimeter." ) );
}

return ptr;
Expand Down Expand Up @@ -505,7 +506,7 @@ double QgsDistanceArea::measurePolygon( const QList<QgsPoint>& points )
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsLogger::warning( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area." ) );
QgsMessageLog::logMessage( QObject::tr( "Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area." ) );
return 0.0;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgsmimedatautils.cpp
Expand Up @@ -16,6 +16,9 @@ QgsMimeDataUtils::Uri::Uri( QgsLayerItem* layerItem )
case QgsMapLayer::RasterLayer:
layerType = "raster";
break;
case QgsMapLayer::PluginLayer:
layerType = "plugin";
break;
}

}
Expand Down
8 changes: 5 additions & 3 deletions src/core/qgsproviderregistry.cpp
Expand Up @@ -29,6 +29,7 @@
#include "qgsdataprovider.h"
#include "qgslogger.h"
#include "qgsmessageoutput.h"
#include "qgsmessagelog.h"
#include "qgsprovidermetadata.h"
#include "qgsvectorlayer.h"

Expand Down Expand Up @@ -394,7 +395,8 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
return dataProvider;
}
else
{ // this is likely because the dataSource is invalid, and isn't
{
// this is likely because the dataSource is invalid, and isn't
// necessarily a reflection on the data provider itself
QgsDebugMsg( "Invalid data provider" );

Expand All @@ -405,7 +407,7 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
}
else
{
QgsLogger::warning( "Unable to instantiate the data provider plugin" );
QgsMessageLog::logMessage( QObject::tr( "Unable to instantiate the data provider plugin %1" ).arg( lib ) );

delete dataProvider;

Expand All @@ -417,7 +419,7 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
}
else
{
QgsLogger::warning( "Failed to load " + lib );
QgsMessageLog::logMessage( QObject::tr( "Failed to load %1: %2" ).arg( lib ).arg( myLib->errorString() ) );
delete myLib;
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion src/core/qgsvectorlayerimport.cpp
Expand Up @@ -20,6 +20,7 @@
#include "qgsfeature.h"
#include "qgsgeometry.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsvectorlayerimport.h"
#include "qgsproviderregistry.h"
Expand Down Expand Up @@ -102,6 +103,7 @@ QgsVectorLayerImport::QgsVectorLayerImport(

if ( vectorProvider )
delete vectorProvider;

return;
}

Expand Down Expand Up @@ -271,7 +273,7 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,

QString msg = QObject::tr( "Failed to transform a point while drawing a feature of type '%1'. Writing stopped. (Exception: %2)" )
.arg( fet.typeName() ).arg( e.what() );
QgsLogger::warning( msg );
QgsMessageLog::logMessage( msg, QObject::tr( "Vector import" ) );
if ( errorMessage )
*errorMessage = msg;

Expand Down

0 comments on commit 5543a89

Please sign in to comment.