Commit 65a30b06 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Some more fixes to exception handling in bauhaus

Reviewed-by: thomas hartmann
parent 0f7db6de
......@@ -135,7 +135,7 @@ QString Exception::backTrace() const
*/
QString Exception::description() const
{
return QString();
return QString("file: %1, function: %2, line: %3").arg(m_file, m_function, QString::number(m_line));
}
/*!
......
......@@ -28,6 +28,7 @@
**************************************************************************/
#include "invalidargumentexception.h"
#include <QString>
/*!
\class QmlDesigner::InvalidArgumentException
......@@ -50,6 +51,15 @@ InvalidArgumentException::InvalidArgumentException(int line,
const QString &argument)
: Exception(line, function, file), m_argument(argument)
{
}
QString InvalidArgumentException::description() const
{
if (function() == "createNode")
return QString(QObject::tr("Failed to create item of type %1")).arg(m_argument);
return Exception::description();
}
/*!
......
......@@ -45,6 +45,7 @@ public:
QString type() const;
QString argument() const;
QString description() const;
private:
const QString m_argument;
......
......@@ -169,9 +169,9 @@ InternalNode::Pointer ModelPrivate::createNode(const QString &typeString,
const QList<QPair<QString, QVariant> > &propertyList)
{
if (typeString.isEmpty())
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, "typeString");
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, tr("invalid type"));
if (!m_metaInfo.nodeMetaInfo(typeString).isValid())
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, "typeString");
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, typeString);
InternalNode::Pointer newInternalNodePointer = InternalNode::create(typeString, majorVersion, minorVersion);
......
......@@ -106,8 +106,10 @@ void DocumentWarningWidget::setError(const RewriterView::Error &error)
QString str;
if (error.type() == RewriterView::Error::ParseError) {
str = tr("%3 (%1:%2)").arg(QString::number(error.line()), QString::number(error.column()), error.description());
m_goToError->show();
} else if (error.type() == RewriterView::Error::InternalError) {
str = tr("Internal error (%1)") .arg(error.description());
str = tr("Internal error (%1)").arg(error.description());
m_goToError->hide();
}
m_errorMessage->setText(str);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment