mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-07-21 10:40:57 -04:00
refactor: Restructure project into sources/tests layout and dissolve PluginLLMCore
This commit is contained in:
54
sources/tools/ToolExceptions.hpp
Normal file
54
sources/tools/ToolExceptions.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
// Copyright (C) 2025-2026 Petr Mironychev
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Additional attribution terms under GPLv3 §7(b) apply — see LICENSE
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QException>
|
||||
#include <QString>
|
||||
|
||||
namespace QodeAssist::Tools {
|
||||
|
||||
class ToolException : public QException
|
||||
{
|
||||
public:
|
||||
explicit ToolException(const QString &message)
|
||||
: m_message(message)
|
||||
, m_stdMessage(message.toStdString())
|
||||
{}
|
||||
|
||||
void raise() const override { throw *this; }
|
||||
ToolException *clone() const override { return new ToolException(*this); }
|
||||
const char *what() const noexcept override { return m_stdMessage.c_str(); }
|
||||
|
||||
QString message() const { return m_message; }
|
||||
|
||||
private:
|
||||
QString m_message;
|
||||
std::string m_stdMessage;
|
||||
};
|
||||
|
||||
class ToolRuntimeError : public ToolException
|
||||
{
|
||||
public:
|
||||
explicit ToolRuntimeError(const QString &message)
|
||||
: ToolException(message)
|
||||
{}
|
||||
|
||||
void raise() const override { throw *this; }
|
||||
ToolRuntimeError *clone() const override { return new ToolRuntimeError(*this); }
|
||||
};
|
||||
|
||||
class ToolInvalidArgument : public ToolException
|
||||
{
|
||||
public:
|
||||
explicit ToolInvalidArgument(const QString &message)
|
||||
: ToolException(message)
|
||||
{}
|
||||
|
||||
void raise() const override { throw *this; }
|
||||
ToolInvalidArgument *clone() const override { return new ToolInvalidArgument(*this); }
|
||||
};
|
||||
|
||||
} // namespace QodeAssist::Tools
|
||||
|
||||
Reference in New Issue
Block a user