27 error.url().toString().toStdString());
29 std::to_string(error.line()));
31 std::to_string(error.column()));
35void reportQmlError(core::ports::diagnostics::IErrorReporter* reporter,
37 const char* origin,
const QQmlError& error) {
39 error.toString().toStdString(),
40 qmlErrorContext(error));
47 if (!quickView || quickView->status() != QQuickView::Error) {
51 const auto errors = quickView->errors();
52 if (errors.isEmpty()) {
58 "QQuickView failed to load the main QML source",
63 for (
const auto& error : errors) {
71 QQmlEngine* engine, QObject* context,
72 std::shared_ptr<core::ports::diagnostics::IErrorReporter> reporter) {
73 if (!engine || !context) {
77 QObject::connect(engine, &QQmlEngine::warnings, context,
78 [reporter = std::move(reporter)](
79 const QList<QQmlError>& warnings) {
80 for (
const auto& warning : warnings) {
Provides shared helpers for reporting structured errors and exceptions.
Declarations for the UI Origins component.
QML runtime diagnostics reporting helpers.
Declarations for the UI Trace component.
Port for reporting structured diagnostic error events.
ErrorSeverity
Severity level for structured error events.
std::vector< std::pair< std::string, std::string > > ErrorContext
Key/value context attached to an error event.
void report(core::ports::diagnostics::IErrorReporter *reporter, const ErrorEvent &event)
Report an already constructed error event when a reporter exists.
void reportQmlLoadErrors(QQuickView *quickView, const QUrl &source, core::ports::diagnostics::IErrorReporter *reporter)
Reports QQuickView load errors through the structured error reporter.
void wireQmlWarnings(QQmlEngine *engine, QObject *context, std::shared_ptr< core::ports::diagnostics::IErrorReporter > reporter)
Wires QQmlEngine runtime warnings into structured error reporting.
constexpr const char * QmlLoadFailed
constexpr const char * QmlWarning
Declarations for the UI ErrorCodes component.