This commit is contained in:
Nav
2022-11-17 00:49:59 +00:00
parent 7a2e8f07b5
commit 3a04fd9b17
4 changed files with 16 additions and 11 deletions

View File

@@ -233,7 +233,7 @@ namespace Bloom::DebugServer::Gdb
throw ClientCommunicationError("GDB client attempted to send too much data");
}
bytesToRead = (!bytes.has_value() || (*bytes - output.size()) > bufferSize)
bytesToRead = !bytes.has_value() || (*bytes - output.size()) > bufferSize
? bufferSize
: (*bytes - output.size());
}

View File

@@ -15,15 +15,11 @@ namespace Bloom::DebugServer::Gdb::Exceptions
public:
explicit DebugSessionInitialisationFailure(const std::string& message)
: Bloom::Exceptions::Exception(message)
{
this->message = message;
}
{}
explicit DebugSessionInitialisationFailure(const char* message)
: Bloom::Exceptions::Exception(message)
{
this->message = std::string(message);
}
{}
explicit DebugSessionInitialisationFailure() = default;
};

View File

@@ -7,7 +7,10 @@ namespace Bloom::Exceptions
class Exception: public std::runtime_error
{
public:
explicit Exception(): std::runtime_error("") {}
explicit Exception()
: std::runtime_error("")
{}
virtual ~Exception() = default;
Exception(const Exception& other) noexcept = default;
@@ -16,9 +19,15 @@ namespace Bloom::Exceptions
Exception& operator = (const Exception& other) = default;
Exception& operator = (Exception&& other) = default;
explicit Exception(const std::string& message): std::runtime_error(message.c_str()), message(message) {}
explicit Exception(const std::string& message)
: std::runtime_error(message.c_str())
, message(message)
{}
explicit Exception(const char* message): std::runtime_error(message), message(std::string(message)) {}
explicit Exception(const char* message)
: std::runtime_error(message)
, message(std::string(message))
{}
const char* what() const noexcept override {
return this->message.c_str();