summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/core/c++/error.hpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/core/c++/error.hpp b/modules/core/c++/error.hpp
index 32b67a0..ceef3c2 100644
--- a/modules/core/c++/error.hpp
+++ b/modules/core/c++/error.hpp
@@ -128,7 +128,7 @@ public:
error_registry& get_error_registry();
template<typename T>
-error::code get_template_id(){
+error::code get_template_error_id(){
static error::code id = std::numeric_limits<error::code>::max();
if(id == std::numeric_limits<error::code>::max()){
@@ -146,20 +146,20 @@ error::code get_template_id(){
}
}
+error make_error(error::code code, const std::string_view &generic);
+
template<typename T> error make_error(const std::string_view& generic){
- error::code id = impl::get_template_id<T>();
+ error::code id = impl::get_template_error_id<T>();
- return error{id, T::is_critical, generic};
+ return make_error(id, generic);
}
template<typename T> error make_error(){
- error::code id = impl::get_template_id<T>();
+ error::code id = impl::get_template_error_id<T>();
- return error{id, T::is_critical};
+ return make_error(id, {});
}
-error make_error(error::code code, const std::string_view &generic);
-
struct error_builder {
private:
std::function<std::string()> func_;
@@ -173,7 +173,7 @@ public:
error make_error(const std::string_view& generic){
try{
std::string err_str = func_();
- error::code id = impl::get_template_id<T>();
+ error::code id = impl::get_template_error_id<T>();
func_ = [](){return "";};
return error{id, T::is_critical, std::move(err_str)};
}catch(const std::exception&){}
@@ -267,7 +267,7 @@ private:
std::variant<error, fix_void<T>> value_or_error_;
static_assert(!std::is_same_v<T, void_t>,
- "Don't use internal private types");
+ "Don't use internal private types");
public:
constexpr error_or():value_or_error_{make_error<err::invalid_state>("Default assignement for error_or constructor.")}{}
@@ -313,7 +313,7 @@ private:
template<typename T>
bool error::is_type() const {
- return error_code_ == impl::get_template_id<T>();
+ return error_code_ == impl::get_template_error_id<T>();
}
} // namespace saw