1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-31 10:45:16 +01:00

Implement what() for existing exceptions (#22845)

This commit is contained in:
Tulio Leao
2024-09-28 14:42:39 -03:00
committed by GitHub
parent c161a3911a
commit 487806c2c8
3 changed files with 24 additions and 0 deletions

View File

@@ -81,6 +81,11 @@ public:
: MissingObjects(std::move(missingObjects))
{
}
const char* what() const noexcept override
{
return "Missing objects";
}
};
class UnsupportedRideTypeException : public std::exception
@@ -92,6 +97,11 @@ public:
: Type(type)
{
}
const char* what() const noexcept override
{
return "Invalid ride type";
}
};
class UnsupportedVersionException : public std::exception
@@ -105,4 +115,9 @@ public:
, TargetVersion(targetVersion)
{
}
const char* what() const noexcept override
{
return "Unexpected version";
}
};

View File

@@ -23,6 +23,7 @@
# include "../core/Memory.hpp"
# include "../core/Path.hpp"
# include "../core/String.hpp"
# include "../localisation/Language.h"
# include "../platform/Platform.h"
# include "Socket.h"
# include "network.h"
@@ -432,4 +433,10 @@ uint32_t ServerList::GetTotalPlayerCount() const
});
}
const char* MasterServerException::what() const noexcept
{
static std::string localisedStatusText = LanguageGetString(StatusText);
return localisedStatusText.c_str();
}
#endif

View File

@@ -80,4 +80,6 @@ public:
: StatusText(statusText)
{
}
const char* what() const noexcept override;
};