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:
@@ -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";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -80,4 +80,6 @@ public:
|
||||
: StatusText(statusText)
|
||||
{
|
||||
}
|
||||
|
||||
const char* what() const noexcept override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user