Make util::not_implemented throw a specific exception type instead of runtime_error

This commit is contained in:
Nikita Lisitsa 2023-05-06 12:54:26 +03:00
parent 6f6a263553
commit 5895c01c4c
2 changed files with 15 additions and 2 deletions

View file

@ -1,8 +1,16 @@
#pragma once
#include <exception>
namespace psemek::util
{
[[noreturn]] void not_implemented();
struct not_implemented_error
: std::exception
{
char const * what() const noexcept override;
};
[[noreturn]] void not_implemented();
}

View file

@ -5,9 +5,14 @@
namespace psemek::util
{
char const * not_implemented_error::what() const noexcept
{
return "not implemented";
}
void not_implemented()
{
throw std::runtime_error("Not implemented");
throw not_implemented_error{};
}
}