18 #include "qgsversion.h"
19 #include "qgsconfig.h"
23 #include <QRegularExpression>
29 , mFunction( function )
57 #if defined(QGISDEBUG) && defined(QGS_GIT_REMOTE_URL)
61 QString remote = QStringLiteral( QGS_GIT_REMOTE_URL );
62 if ( !hash.isEmpty() && !remote.isEmpty() && remote.contains( QLatin1String(
"github.com" ) ) )
64 QString path = remote.remove( QRegularExpression(
".*github.com[:/]" ) ).remove( QStringLiteral(
".git" ) );
65 srcUrl =
"https://github.com/" + path +
"/blob/" + hash;
69 const auto constMMessageList = mMessageList;
75 const int sPrefixLength = strlen( CMAKE_SOURCE_DIR ) + 1;
76 file = m.file().mid( sPrefixLength );
88 if ( !m.tag().isEmpty() )
95 if ( !file.isEmpty() )
97 where += QStringLiteral(
"file: %1 row: %2" ).arg( file ).arg( m.line() );
99 if ( !m.function().isEmpty() )
101 where += QStringLiteral(
"function %1:" ).arg( m.function() );
103 if ( !where.isEmpty() )
105 str += QStringLiteral(
" (%1)" ).arg( where );
111 str +=
"<p><b>" + m.tag() +
":</b> " + m.message();
113 const QString location = QStringLiteral(
"%1 : %2 : %3" ).arg( file ).arg( m.line() ).arg( m.function() );
114 if ( !srcUrl.isEmpty() )
116 const QString url = QStringLiteral(
"%1/%2#L%3" ).arg( srcUrl, file ).arg( m.line() );
117 str += QStringLiteral(
"<br>(<a href='%1'>%2</a>)" ).arg( url, location );
121 str += QStringLiteral(
"<br>(%1)" ).arg( location );
132 return mMessageList.first().message();
static QString devVersion()
The development version.
QgsErrorMessage represents single error message.
QgsErrorMessage()=default
Constructor for QgsErrorMessage.
QgsError()=default
Constructor for QgsError.
QString message(QgsErrorMessage::Format format=QgsErrorMessage::Html) const
Full error messages description.
QString summary() const
Short error description, usually the first error in chain, the real error.
void append(const QString &message, const QString &tag)
Append new error message.