![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Represents an error message connected to the dom. More...
#include <qqmldomerrormessage_p.h>
Public Types | |
| using | Level = ErrorLevel |
Public Member Functions | |
| ErrorMessage (const QString &message, const ErrorGroups &errorGroups, Level level=Level::Warning, const Path &path=Path(), const QString &file=QString(), SourceLocation location=SourceLocation(), QLatin1String errorId=QLatin1String("")) | |
| ErrorMessage (const ErrorGroups &errorGroups, const DiagnosticMessage &msg, const Path &path=Path(), const QString &file=QString(), QLatin1String errorId=QLatin1String("")) | |
| ErrorMessage & | withErrorId (QLatin1String errorId) |
| ErrorMessage & | withPath (const Path &) |
| ErrorMessage & | withFile (const QString &) |
| ErrorMessage & | withFile (QStringView) |
| ErrorMessage & | withLocation (SourceLocation) |
| ErrorMessage & | withItem (const DomItem &) |
| ErrorMessage | handle (const ErrorHandler &errorHandler=nullptr) |
| void | dump (const Sink &s) const |
| QString | toString () const |
| QCborMap | toCbor () const |
Static Public Member Functions | |
| static QLatin1String | msg (const char *errorId, ErrorMessage &&err) |
| static QLatin1String | msg (QLatin1String errorId, ErrorMessage &&err) |
| static void | visitRegisteredMessages (function_ref< bool(const ErrorMessage &)> visitor) |
| static ErrorMessage | load (QLatin1String errorId) |
| static ErrorMessage | load (const char *errorId) |
| template<typename... T> | |
| static ErrorMessage | load (QLatin1String errorId, T... args) |
Public Attributes | |
| QLatin1String | errorId |
| QString | message |
| ErrorGroups | errorGroups |
| Level | level |
| Path | path |
| QString | file |
| SourceLocation | location |
Friends | |
| int | compare (const ErrorMessage &msg1, const ErrorMessage &msg2) |
Represents an error message connected to the dom.
The error messages should be translated, but they do not need to be pre registered. To give a meaningful handling of error messages ErrorMessages have "tags" (ErrorGroup) that are grouped toghether in ErrorGroups.
To create an ErrorMessage from scratch the best way is to use one of the methods provided by an ErrorGroups object. For example create an ErrorGroups called myErrors and use it to create all your errors.
You can preregister the errors giving them a unique name (reverse dns notation is encouraged) with the msg function. This unique name (errorId) is a const char* (QLatin1String) to integrate better with the tr function. Ideally you create variables to store the errorId either by creating variables with plain strings that you use to initialize the error messages
or using the result of the msg function
and then use them like this
or using directly the string (more error prone)
The \l{withItem} method can be used to set the path file and location if not aready set.
Definition at line 101 of file qqmldomerrormessage_p.h.
Definition at line 105 of file qqmldomerrormessage_p.h.
| QQmlJS::Dom::ErrorMessage::ErrorMessage | ( | const QString & | message, |
| const ErrorGroups & | errorGroups, | ||
| Level | level = Level::Warning, | ||
| const Path & | path = Path(), | ||
| const QString & | file = QString(), | ||
| SourceLocation | location = SourceLocation(), | ||
| QLatin1String | errorId = QLatin1String("") ) |
Definition at line 257 of file qqmldomerrormessage.cpp.
References ErrorMessage().
Referenced by ErrorMessage().
| QQmlJS::Dom::ErrorMessage::ErrorMessage | ( | const ErrorGroups & | errorGroups, |
| const DiagnosticMessage & | msg, | ||
| const Path & | path = Path(), | ||
| const QString & | file = QString(), | ||
| QLatin1String | errorId = QLatin1String("") ) |
Definition at line 272 of file qqmldomerrormessage.cpp.
References ErrorMessage().
Referenced by ErrorMessage().
Definition at line 433 of file qqmldomerrormessage.cpp.
| ErrorMessage QQmlJS::Dom::ErrorMessage::handle | ( | const ErrorHandler & | errorHandler = nullptr | ) |
Definition at line 424 of file qqmldomerrormessage.cpp.
References QQmlJS::Dom::defaultErrorHandler().
Referenced by QQmlJS::Dom::LoadInfo::doCopy(), and QQmlJS::Dom::resolveReference().
|
staticnodiscard |
Definition at line 375 of file qqmldomerrormessage.cpp.
References load().
Referenced by load(), and load().
|
staticnodiscard |
Definition at line 363 of file qqmldomerrormessage.cpp.
References QQmlJS::Dom::ErrorGroups::error(), QQmlJS::Dom::myErrors(), and QQmlJS::Dom::registryMutex().
|
inlinestaticnodiscard |
Definition at line 113 of file qqmldomerrormessage_p.h.
References load().
|
static |
Definition at line 323 of file qqmldomerrormessage.cpp.
|
static |
Definition at line 328 of file qqmldomerrormessage.cpp.
References QQmlJS::Dom::ErrorGroups::debug(), QQmlJS::Dom::myErrors(), QQmlJS::Dom::registryMutex(), and QQmlJS::Dom::ErrorGroups::warning().
| QCborMap QQmlJS::Dom::ErrorMessage::toCbor | ( | ) | const |
Definition at line 468 of file qqmldomerrormessage.cpp.
| QString QQmlJS::Dom::ErrorMessage::toString | ( | ) | const |
Definition at line 463 of file qqmldomerrormessage.cpp.
|
static |
Definition at line 348 of file qqmldomerrormessage.cpp.
References QQmlJS::Dom::registryMutex().
|
nodiscard |
Definition at line 380 of file qqmldomerrormessage.cpp.
|
nodiscard |
Definition at line 392 of file qqmldomerrormessage.cpp.
|
nodiscard |
Definition at line 398 of file qqmldomerrormessage.cpp.
|
nodiscard |
Definition at line 410 of file qqmldomerrormessage.cpp.
Referenced by QQmlJS::Dom::DomItem::addError().
|
nodiscard |
Definition at line 404 of file qqmldomerrormessage.cpp.
|
nodiscard |
Definition at line 386 of file qqmldomerrormessage.cpp.
|
friend |
Definition at line 139 of file qqmldomerrormessage_p.h.
References QQmlJS::Dom::Path::cmp().
Referenced by QQmlJS::Dom::operator!=(), QQmlJS::Dom::operator<(), QQmlJS::Dom::operator<=(), QQmlJS::Dom::operator==(), QQmlJS::Dom::operator>(), and QQmlJS::Dom::operator>=().
| ErrorGroups QQmlJS::Dom::ErrorMessage::errorGroups |
Definition at line 182 of file qqmldomerrormessage_p.h.
| QLatin1String QQmlJS::Dom::ErrorMessage::errorId |
Definition at line 180 of file qqmldomerrormessage_p.h.
| QString QQmlJS::Dom::ErrorMessage::file |
Definition at line 185 of file qqmldomerrormessage_p.h.
| Level QQmlJS::Dom::ErrorMessage::level |
Definition at line 183 of file qqmldomerrormessage_p.h.
| SourceLocation QQmlJS::Dom::ErrorMessage::location |
Definition at line 186 of file qqmldomerrormessage_p.h.
| QString QQmlJS::Dom::ErrorMessage::message |
Definition at line 181 of file qqmldomerrormessage_p.h.
Referenced by PRESUBMIT_test_mocks.MockOutputApi.PresubmitResult::__repr__().
| Path QQmlJS::Dom::ErrorMessage::path |
Definition at line 184 of file qqmldomerrormessage_p.h.