make format errors internal errors
parent
2f3d5ea938
commit
d7c93fa8b9
|
@ -569,7 +569,7 @@ private:
|
|||
bool p_gap;
|
||||
};
|
||||
|
||||
struct cs_error {
|
||||
struct LIBCUBESCRIPT_EXPORT cs_error {
|
||||
friend struct cs_state;
|
||||
|
||||
cs_error() = delete;
|
||||
|
|
|
@ -131,8 +131,7 @@ std::string_view cs_error::save_msg(
|
|||
);
|
||||
}
|
||||
if (sz <= 0) {
|
||||
strncpy(cs.p_errbuf, "format error", sizeof(cs.p_errbuf));
|
||||
sz = strlen(cs.p_errbuf);
|
||||
throw cs_internal_error{"format error"};
|
||||
}
|
||||
return std::string_view{cs.p_errbuf, std::size_t(sz)};
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ void cs_init_lib_string(cs_state &cs) {
|
|||
return;
|
||||
}
|
||||
/* should pretty much be unreachable */
|
||||
throw cs_error{ccs, "format error"};
|
||||
throw cs_internal_error{"format error"};
|
||||
});
|
||||
|
||||
cs.new_command("substr", "siiN", [](auto &, auto args, auto &res) {
|
||||
|
|
Loading…
Reference in New Issue