fix: Add tool exception for logging purpose

This commit is contained in:
Petr Mironychev
2025-10-21 00:51:42 +02:00
parent c95b20d6d4
commit 7e878cdbf8
9 changed files with 165 additions and 33 deletions

View File

@ -18,6 +18,7 @@
*/
#include "ReadVisibleFilesTool.hpp"
#include "ToolExceptions.hpp"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
@ -85,7 +86,7 @@ QFuture<QString> ReadVisibleFilesTool::executeAsync(const QJsonObject &input)
if (editors.isEmpty()) {
QString error = "Error: No visible files in the editor";
throw std::runtime_error(error.toStdString());
throw ToolRuntimeError(error);
}
QStringList results;
@ -121,7 +122,7 @@ QFuture<QString> ReadVisibleFilesTool::executeAsync(const QJsonObject &input)
if (results.isEmpty()) {
QString error = "Error: All visible files are excluded by .qodeassistignore";
throw std::runtime_error(error.toStdString());
throw ToolRuntimeError(error);
}
return results.join("\n\n" + QString(80, '=') + "\n\n");