[libcalamaresui] Improve explainYamlException
- overloads for common kinds of label - improve error reporting when reading settings and branding files
This commit is contained in:
parent
e5ca8e091f
commit
fdda0e14aa
@ -156,12 +156,12 @@ Settings::Settings( const QString& settingsFilePath,
|
||||
}
|
||||
catch ( YAML::Exception& e )
|
||||
{
|
||||
cWarning() << "YAML parser error " << e.what() << "in" << file.fileName();
|
||||
CalamaresUtils::explainYamlException( e, ba, file.fileName() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "Cannot read " << file.fileName();
|
||||
cWarning() << "Cannot read settings file" << file.fileName();
|
||||
}
|
||||
|
||||
s_instance = this;
|
||||
|
@ -114,6 +114,19 @@ void
|
||||
explainYamlException( const YAML::Exception& e, const QByteArray& yamlData, const char *label )
|
||||
{
|
||||
cWarning() << "YAML error " << e.what() << "in" << label << '.';
|
||||
explainYamlException( e, yamlData );
|
||||
}
|
||||
|
||||
void
|
||||
explainYamlException( const YAML::Exception& e, const QByteArray& yamlData, const QString& label )
|
||||
{
|
||||
cWarning() << "YAML error " << e.what() << "in" << label << '.';
|
||||
explainYamlException( e, yamlData );
|
||||
}
|
||||
|
||||
void
|
||||
explainYamlException( const YAML::Exception& e, const QByteArray& yamlData )
|
||||
{
|
||||
if ( ( e.mark.line >= 0 ) && ( e.mark.column >= 0 ) )
|
||||
{
|
||||
// Try to show the line where it happened.
|
||||
@ -172,7 +185,7 @@ loadYaml(const QString& filename, bool* ok)
|
||||
}
|
||||
catch ( YAML::Exception& e )
|
||||
{
|
||||
explainYamlException( e, ba, filename.toLatin1().constData() );
|
||||
explainYamlException( e, ba, filename );
|
||||
return QVariantMap();
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,8 @@ QVariant yamlMapToVariant( const YAML::Node& mapNode );
|
||||
* Uses @p label when labeling the data source (e.g. "netinstall data")
|
||||
*/
|
||||
void explainYamlException( const YAML::Exception& e, const QByteArray& data, const char *label );
|
||||
void explainYamlException( const YAML::Exception& e, const QByteArray& data, const QString& label );
|
||||
void explainYamlException( const YAML::Exception& e, const QByteArray& data );
|
||||
|
||||
} //ns
|
||||
|
||||
|
@ -179,7 +179,7 @@ Branding::Branding( const QString& brandingFilePath,
|
||||
}
|
||||
catch ( YAML::Exception& e )
|
||||
{
|
||||
cWarning() << "YAML parser error " << e.what() << "in" << file.fileName();
|
||||
CalamaresUtils::explainYamlException( e, ba, file.fileName() );
|
||||
}
|
||||
|
||||
QDir translationsDir( componentDir.filePath( "lang" ) );
|
||||
@ -192,7 +192,7 @@ Branding::Branding( const QString& brandingFilePath,
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "Cannot read " << file.fileName();
|
||||
cWarning() << "Cannot read branding file" << file.fileName();
|
||||
}
|
||||
|
||||
s_instance = this;
|
||||
|
Loading…
Reference in New Issue
Block a user