diff options
Diffstat (limited to 'src/platform/Exception.cpp')
-rw-r--r-- | src/platform/Exception.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/platform/Exception.cpp b/src/platform/Exception.cpp new file mode 100644 index 00000000..7aef3b7f --- /dev/null +++ b/src/platform/Exception.cpp @@ -0,0 +1,44 @@ +#include "cru/platform/Exception.h" +#include "cru/common/Format.h" + +#include <optional> + +namespace cru::platform { +PlatformNotMatchException::PlatformNotMatchException( + String resource_platform, String target_platform, + std::optional<StringView> additional_message) + : resource_platform_(std::move(resource_platform)), + target_platform_(std::move(target_platform)) { + SetMessage( + Format(u"Resource platform '{}' does not match target platform '{}'.", + resource_platform_, target_platform_)); + + AppendMessage(additional_message); +} + +PlatformNotMatchException::~PlatformNotMatchException() {} + +String PlatformNotMatchException::GetResourcePlatform() const { + return resource_platform_; +} + +String PlatformNotMatchException::GetTargetPlatform() const { + return target_platform_; +} + +PlatformUnsupportedException::PlatformUnsupportedException( + String platform, String operation, + std::optional<StringView> additional_message) + : platform_(std::move(platform)), operation_(std::move(operation)) { + SetMessage(Format(u"Operation '{}' is not supported on platform '{}'.", + operation_, platform_)); + AppendMessage(additional_message); +} + +PlatformUnsupportedException::~PlatformUnsupportedException() {} + +String PlatformUnsupportedException::GetPlatform() const { return platform_; } + +String PlatformUnsupportedException::GetOperation() const { return operation_; } + +} // namespace cru::platform |