Просмотр исходного кода

As part of fixing https://github.com/o3de/o3de-extras/issues/118 (#227)

it was discovered that the error log from xacro is cut off on the
first angle bracket, making it impossible to see the actual error
problem fully if it occurs.

This change surrounds the error text with a code macro (three
backticks) so that it shows up in markdown as the actual literal code,
which causes Qt to ignore any angle brackets and other markdown inside
the text.

https://github.com/o3de/o3de-extras/issues/118

(Will attach a screenshot)

Signed-off-by: Nicholas Lawson <[email protected]>
Nicholas Lawson 2 лет назад
Родитель
Сommit
4e80df8ff9
1 измененных файлов с 24 добавлено и 5 удалено
  1. 24 5
      Gems/ROS2/Code/Source/RobotImporter/RobotImporterWidget.cpp

+ 24 - 5
Gems/ROS2/Code/Source/RobotImporter/RobotImporterWidget.cpp

@@ -89,16 +89,35 @@ namespace ROS2
                 if (outcome)
                 {
                     m_parsedUrdf = outcome.m_urdfHandle;
-                    report += "# " + tr("XACRO execution succeed") + "\n";
+                    report += "# " + tr("XACRO execution succeeded") + "\n";
                 }
                 else
                 {
                     report += "# " + tr("XACRO parsing failed") + "\n";
-                    report += "\n\n" + tr("Command called : \n'") + QString::fromUtf8(outcome.m_called.data()) + "'";
+                    report += "\n\n## " + tr("Command called") +  "\n\n`" + QString::fromUtf8(outcome.m_called.data()) + "`";
                     report += "\n\n" + tr("Process failed");
-                    report += "\n\n" + tr("error output") + " :\n\n";
-                    report +=
-                        QString::fromLocal8Bit(outcome.m_logErrorOutput.data(), static_cast<int>(outcome.m_logErrorOutput.size())) + "\n";
+                    report += "\n\n## " + tr("Error output") + "\n\n";
+                    report += "```\n";
+                    if (outcome.m_logErrorOutput.size())
+                    {
+                        report += QString::fromLocal8Bit(outcome.m_logErrorOutput.data(), static_cast<int>(outcome.m_logErrorOutput.size()));
+                    }
+                    else
+                    {
+                        report += tr("(EMPTY)");
+                    }
+                    report += "\n```";
+                    report += "\n\n## " + tr("Standard output") + "\n\n";
+                    report += "```\n";
+                    if (outcome.m_logStandardOutput.size())
+                    {
+                        report += QString::fromLocal8Bit(outcome.m_logStandardOutput.data(), static_cast<int>(outcome.m_logStandardOutput.size()));
+                    }
+                    else
+                    {
+                        report += tr("(EMPTY)");
+                    }
+                    report += "\n```";
                     m_checkUrdfPage->ReportURDFResult(report, false);
                     m_parsedUrdf = nullptr;
                     return;