1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Improved error reporting

This commit is contained in:
Martin Tůma 2023-12-31 01:12:46 +01:00
parent e13d6dfc4b
commit 2541797e7d
4 changed files with 8 additions and 4 deletions

View File

@ -52,8 +52,10 @@ bool GMAPData::readXML(const QString &path, QString &dataDir, QString &typFile)
{ {
QFile file(path); QFile file(path);
if (!file.open(QFile::ReadOnly | QFile::Text)) if (!file.open(QFile::ReadOnly | QFile::Text)) {
_errorString = file.errorString();
return false; return false;
}
QXmlStreamReader reader(&file); QXmlStreamReader reader(&file);
if (reader.readNextStartElement()) { if (reader.readNextStartElement()) {

View File

@ -395,7 +395,7 @@ BSBMap::BSBMap(const QString &fileName, QObject *parent)
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
_errorString = fileName + ": " + file.errorString(); _errorString = file.errorString();
return; return;
} }

View File

@ -366,8 +366,10 @@ bool OruxMap::readXML(const QString &path, const QString &dir)
{ {
QFile file(path); QFile file(path);
if (!file.open(QFile::ReadOnly | QFile::Text)) if (!file.open(QFile::ReadOnly | QFile::Text)) {
_errorString = file.errorString();
return false; return false;
}
QXmlStreamReader reader(&file); QXmlStreamReader reader(&file);
if (reader.readNextStartElement()) { if (reader.readNextStartElement()) {

View File

@ -327,7 +327,7 @@ QCTMap::QCTMap(const QString &fileName, QObject *parent)
_mapRatio(1.0), _valid(false) _mapRatio(1.0), _valid(false)
{ {
if (!_file.open(QIODevice::ReadOnly)) { if (!_file.open(QIODevice::ReadOnly)) {
_errorString = fileName + ": " + _file.errorString(); _errorString = _file.errorString();
return; return;
} }