Make util::not_implemented throw a specific exception type instead of runtime_error
This commit is contained in:
parent
6f6a263553
commit
5895c01c4c
2 changed files with 15 additions and 2 deletions
|
|
@ -1,8 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
namespace psemek::util
|
namespace psemek::util
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct not_implemented_error
|
||||||
|
: std::exception
|
||||||
|
{
|
||||||
|
char const * what() const noexcept override;
|
||||||
|
};
|
||||||
|
|
||||||
[[noreturn]] void not_implemented();
|
[[noreturn]] void not_implemented();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,14 @@
|
||||||
namespace psemek::util
|
namespace psemek::util
|
||||||
{
|
{
|
||||||
|
|
||||||
|
char const * not_implemented_error::what() const noexcept
|
||||||
|
{
|
||||||
|
return "not implemented";
|
||||||
|
}
|
||||||
|
|
||||||
void not_implemented()
|
void not_implemented()
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Not implemented");
|
throw not_implemented_error{};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue