Skip to content
Permalink
Browse files
log more error messages
  • Loading branch information
jef-n committed Nov 25, 2011
1 parent 61e0065 commit 5543a89bb0fe509f41a115ac0533313da626b339
Showing with 17 additions and 9 deletions.
  1. +6 −5 src/core/qgsdistancearea.cpp
  2. +3 −0 src/core/qgsmimedatautils.cpp
  3. +5 −3 src/core/qgsproviderregistry.cpp
  4. +3 −1 src/core/qgsvectorlayerimport.cpp
@@ -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
@@ -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;
@@ -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;
}

@@ -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;
}
}
@@ -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;
@@ -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;
}
}
@@ -16,6 +16,9 @@ QgsMimeDataUtils::Uri::Uri( QgsLayerItem* layerItem )
case QgsMapLayer::RasterLayer:
layerType = "raster";
break;
case QgsMapLayer::PluginLayer:
layerType = "plugin";
break;
}

}
@@ -29,6 +29,7 @@
#include "qgsdataprovider.h"
#include "qgslogger.h"
#include "qgsmessageoutput.h"
#include "qgsmessagelog.h"
#include "qgsprovidermetadata.h"
#include "qgsvectorlayer.h"

@@ -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" );

@@ -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;

@@ -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;
}
@@ -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"
@@ -102,6 +103,7 @@ QgsVectorLayerImport::QgsVectorLayerImport(

if ( vectorProvider )
delete vectorProvider;

return;
}

@@ -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;

0 comments on commit 5543a89

Please sign in to comment.