Improve formatting of error messages

This commit is contained in:
Aurélien Gâteau 2014-08-01 09:56:40 +02:00
parent b111027d57
commit 90670f8b46
3 changed files with 18 additions and 21 deletions

View File

@ -270,9 +270,14 @@ Helper::handleLastError()
msgList.append( valMsg );
if ( !tbMsg.isEmpty() )
msgList.append( QString( "</code>Traceback:<code><br/>%1" ).arg( tbMsg ) );
{
msgList.append( "Traceback:" );
msgList.append( QString( "<pre>%1</pre>" ).arg( tbMsg ) );
cDebug() << "tbMsg" << tbMsg;
}
return QString( "<code>%1</code>" ).arg( msgList.join( "<br/>" ) );
// Return a string made of the msgList items, wrapped in <div> tags
return QString( "<div>%1</div>" ).arg( msgList.join( "</div><div>" ) );
}

View File

@ -195,11 +195,7 @@ PythonJob::exec()
bp::tuple resultTuple = bp::extract< bp::tuple >( runResult );
QString message = QString::fromStdString( bp::extract< std::string >( resultTuple[ 0 ] ) );
QString description = QString::fromStdString( bp::extract< std::string >( resultTuple[ 1 ] ) );
return JobResult::error( tr( "Job \"%1\" finished with error" )
.arg( prettyName() ),
QString( "<strong>%1</strong><br/>%2" )
.arg( message )
.arg( description ) );
return JobResult::error( message, description );
}
}
catch ( bp::error_already_set )
@ -211,7 +207,7 @@ PythonJob::exec()
}
bp::handle_exception();
PyErr_Clear();
return JobResult::error( tr( "Boost.Python error in job \"%1\"" ).arg( prettyName() ),
return JobResult::error( tr( "Boost.Python error in job \"%1\"." ).arg( prettyName() ),
msg );
}

View File

@ -116,24 +116,20 @@ ViewManager::insertViewStep( int before, ViewStep* step)
void
ViewManager::onInstallationFailed( const QString& message, const QString& details )
{
QString text = tr(
"<p><b>Installation Failed</b></p>"
"<p>%1</p>"
).arg( message );
QMessageBox msgBox;
msgBox.setIcon( QMessageBox::Critical );
msgBox.setWindowTitle( tr("Error") );
msgBox.setText( "<strong>" + tr( "Installation Failed" ) + "</strong>" );
msgBox.setStandardButtons( QMessageBox::Close );
QString text = "<p>" + message + "</p>";
if ( !details.isEmpty() )
{
text += tr(
"<p>%1</p>"
).arg( details );
text += "<p>" + details + "</p>";
}
msgBox.setInformativeText( text );
QMessageBox::critical(
QApplication::activeWindow(),
tr( "Error" ),
text,
QMessageBox::Close
);
msgBox.exec();
QApplication::quit();
}