netlist: more consistent exception handling. (nw)

Still not optimal, but better than what we had previously. No exception
logging comes closer.
This commit is contained in:
couriersud 2019-11-05 00:08:52 +01:00
parent f315e47b89
commit 22e07506cc
17 changed files with 52 additions and 52 deletions

View File

@ -69,7 +69,7 @@ public:
} }
protected: protected:
void vlog(const plib::plog_level &l, const pstring &ls) const override void vlog(const plib::plog_level &l, const pstring &ls) const noexcept override
{ {
switch (l) switch (l)
{ {
@ -89,7 +89,9 @@ protected:
m_parent.logerror("netlist ERROR: %s\n", ls.c_str()); m_parent.logerror("netlist ERROR: %s\n", ls.c_str());
break; break;
case plib::plog_level::FATAL: case plib::plog_level::FATAL:
throw emu_fatalerror(1, "netlist FATAL: %s\n", ls.c_str()); //throw emu_fatalerror(1, "netlist FATAL: %s\n", ls.c_str());
m_parent.logerror("netlist FATAL: %s\n", ls.c_str());
break;
} }
} }
@ -107,7 +109,7 @@ public:
} }
protected: protected:
void vlog(const plib::plog_level &l, const pstring &ls) const override void vlog(const plib::plog_level &l, const pstring &ls) const noexcept override
{ {
switch (l) switch (l)
{ {
@ -125,7 +127,9 @@ protected:
osd_printf_error("netlist ERROR: %s\n", ls); osd_printf_error("netlist ERROR: %s\n", ls);
break; break;
case plib::plog_level::FATAL: case plib::plog_level::FATAL:
throw emu_fatalerror(1, "netlist FATAL: %s\n", ls.c_str()); osd_printf_error("netlist FATAL: %s\n", ls);
break;
//throw emu_fatalerror(1, "netlist FATAL: %s\n", ls.c_str());
} }
} }

View File

@ -63,7 +63,7 @@ namespace analog
{ {
plib::unused_var(d1); plib::unused_var(d1);
if (b) if (b)
throw nl_exception("bselect with netlist and b==true"); plib::pthrow<nl_exception>("bselect with netlist and b==true");
return d2; return d2;
} }

View File

@ -23,7 +23,7 @@ namespace netlist
, m_writer(&m_strm) , m_writer(&m_strm)
{ {
if (m_strm.fail()) if (m_strm.fail())
throw plib::file_open_e(plib::pfmt("{1}.log")(this->name())); plib::pthrow<plib::file_open_e>(plib::pfmt("{1}.log")(this->name()));
m_strm.imbue(std::locale::classic()); m_strm.imbue(std::locale::classic());
} }

View File

@ -244,7 +244,7 @@ namespace netlist
m_family_desc = anetlist.setup().family_from_model(m_family_name); m_family_desc = anetlist.setup().family_from_model(m_family_name);
if (m_family_desc == nullptr) if (m_family_desc == nullptr)
throw nl_exception("family description not found for {1}", m_family_name); plib::pthrow<nl_exception>("family description not found for {1}", m_family_name);
return pool().make_unique<tt_type>(anetlist, name, m_family_desc, *m_ttbl, m_desc); return pool().make_unique<tt_type>(anetlist, name, m_family_desc, *m_ttbl, m_desc);
} }
@ -353,7 +353,7 @@ void truthtable_parser::parseline(unsigned cur, std::vector<pstring> list,
{ {
// cutoff previous inputs and outputs for ignore // cutoff previous inputs and outputs for ignore
if (m_out_state[nstate] != m_out_state.mask() && m_out_state[nstate] != val) if (m_out_state[nstate] != m_out_state.mask() && m_out_state[nstate] != val)
throw nl_exception(plib::pfmt("Error in truthtable: State {1:04} already set, {2} != {3}\n") plib::pthrow<nl_exception>(plib::pfmt("Error in truthtable: State {1:04} already set, {2} != {3}\n")
.x(nstate.as_uint())(m_out_state[nstate])(val) ); .x(nstate.as_uint())(m_out_state[nstate])(val) );
m_out_state.set(nstate, val); m_out_state.set(nstate, val);
for (std::size_t j=0; j<m_NO; j++) for (std::size_t j=0; j<m_NO; j++)
@ -449,7 +449,7 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
for (size_t i=0; i<m_size; i++) for (size_t i=0; i<m_size; i++)
{ {
if (m_out_state[i] == m_out_state.mask()) if (m_out_state[i] == m_out_state.mask())
throw nl_exception(plib::pfmt("truthtable: found element not set {1}\n").x(i) ); plib::pthrow<nl_exception>(plib::pfmt("truthtable: found element not set {1}\n").x(i) );
m_out_state.set(i, m_out_state[i] | (ign[i] << m_NO)); m_out_state.set(i, m_out_state[i] | (ign[i] << m_NO));
} }
} }

View File

@ -161,7 +161,7 @@ class NETLIB_NAME(name) : public device_t
//============================================================ //============================================================
#if defined(MAME_DEBUG) || (NL_DEBUG == true) #if defined(MAME_DEBUG) || (NL_DEBUG == true)
#define nl_assert(x) do { if (1) if (!(x)) throw nl_exception(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); } while (0) #define nl_assert(x) do { if (1) if (!(x)) plib::pthrow<nl_exception>(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); } while (0)
#define NL_NOEXCEPT #define NL_NOEXCEPT
#else #else
#define nl_assert(x) do { if (0) if (!(x)) { /*throw nl_exception(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); */} } while (0) #define nl_assert(x) do { if (0) if (!(x)) { /*throw nl_exception(plib::pfmt("assert: {1}:{2}: {3}")(__FILE__)(__LINE__)(#x) ); */} } while (0)

View File

@ -20,7 +20,6 @@ void parser_t::verror(const pstring &msg)
{ {
m_setup.log().fatal("{1}", msg); m_setup.log().fatal("{1}", msg);
plib::pthrow<nl_exception>(plib::pfmt("{1}")(msg)); plib::pthrow<nl_exception>(plib::pfmt("{1}")(msg));
//throw error;
} }
bool parser_t::parse(const pstring &nlname) bool parser_t::parse(const pstring &nlname)

View File

@ -902,11 +902,11 @@ void models_t::register_model(const pstring &model_in)
{ {
auto pos = model_in.find(' '); auto pos = model_in.find(' ');
if (pos == pstring::npos) if (pos == pstring::npos)
throw nl_exception(MF_UNABLE_TO_PARSE_MODEL_1(model_in)); plib::pthrow<nl_exception>(MF_UNABLE_TO_PARSE_MODEL_1(model_in));
pstring model = plib::ucase(plib::trim(plib::left(model_in, pos))); pstring model = plib::ucase(plib::trim(plib::left(model_in, pos)));
pstring def = plib::trim(model_in.substr(pos + 1)); pstring def = plib::trim(model_in.substr(pos + 1));
if (!m_models.insert({model, def}).second) if (!m_models.insert({model, def}).second)
throw nl_exception(MF_MODEL_ALREADY_EXISTS_1(model_in)); plib::pthrow<nl_exception>(MF_MODEL_ALREADY_EXISTS_1(model_in));
} }
void models_t::model_parse(const pstring &model_in, model_map_t &map) void models_t::model_parse(const pstring &model_in, model_map_t &map)
@ -923,7 +923,7 @@ void models_t::model_parse(const pstring &model_in, model_map_t &map)
key = plib::ucase(model); key = plib::ucase(model);
auto i = m_models.find(key); auto i = m_models.find(key);
if (i == m_models.end()) if (i == m_models.end())
throw nl_exception(MF_MODEL_NOT_FOUND(model)); plib::pthrow<nl_exception>(MF_MODEL_NOT_FOUND(model));
model = i->second; model = i->second;
} }
pstring xmodel = plib::left(model, pos); pstring xmodel = plib::left(model, pos);
@ -936,12 +936,12 @@ void models_t::model_parse(const pstring &model_in, model_map_t &map)
if (i != m_models.end()) if (i != m_models.end())
model_parse(xmodel, map); model_parse(xmodel, map);
else else
throw nl_exception(MF_MODEL_NOT_FOUND(model_in)); plib::pthrow<nl_exception>(MF_MODEL_NOT_FOUND(model_in));
} }
pstring remainder = plib::trim(model.substr(pos + 1)); pstring remainder = plib::trim(model.substr(pos + 1));
if (!plib::endsWith(remainder, ")")) if (!plib::endsWith(remainder, ")"))
throw nl_exception(MF_MODEL_ERROR_1(model)); plib::pthrow<nl_exception>(MF_MODEL_ERROR_1(model));
// FIMXE: Not optimal // FIMXE: Not optimal
remainder = plib::left(remainder, remainder.size() - 1); remainder = plib::left(remainder, remainder.size() - 1);
@ -950,7 +950,7 @@ void models_t::model_parse(const pstring &model_in, model_map_t &map)
{ {
auto pose = pe.find('='); auto pose = pe.find('=');
if (pose == pstring::npos) if (pose == pstring::npos)
throw nl_exception(MF_MODEL_ERROR_ON_PAIR_1(model)); plib::pthrow<nl_exception>(MF_MODEL_ERROR_ON_PAIR_1(model));
map[plib::ucase(plib::left(pe, pose))] = pe.substr(pose + 1); map[plib::ucase(plib::left(pe, pose))] = pe.substr(pose + 1);
} }
} }
@ -975,9 +975,9 @@ pstring models_t::value_str(const pstring &model, const pstring &entity)
pstring ret; pstring ret;
if (entity != plib::ucase(entity)) if (entity != plib::ucase(entity))
throw nl_exception(MF_MODEL_PARAMETERS_NOT_UPPERCASE_1_2(entity, model_string(map))); plib::pthrow<nl_exception>(MF_MODEL_PARAMETERS_NOT_UPPERCASE_1_2(entity, model_string(map)));
if (map.find(entity) == map.end()) if (map.find(entity) == map.end())
throw nl_exception(MF_ENTITY_1_NOT_FOUND_IN_MODEL_2(entity, model_string(map))); plib::pthrow<nl_exception>(MF_ENTITY_1_NOT_FOUND_IN_MODEL_2(entity, model_string(map)));
else else
ret = map[entity]; ret = map[entity];
@ -1008,7 +1008,7 @@ nl_fptype models_t::value(const pstring &model, const pstring &entity)
case 'a': factor = nlconst::magic(1e-18); break; case 'a': factor = nlconst::magic(1e-18); break;
default: default:
if (*p < '0' || *p > '9') if (*p < '0' || *p > '9')
throw nl_exception(MF_UNKNOWN_NUMBER_FACTOR_IN_1(entity)); plib::pthrow<nl_exception>(MF_UNKNOWN_NUMBER_FACTOR_IN_1(entity));
} }
if (factor != nlconst::one()) if (factor != nlconst::one())
tmp = plib::left(tmp, tmp.size() - 1); tmp = plib::left(tmp, tmp.size() - 1);
@ -1017,7 +1017,7 @@ nl_fptype models_t::value(const pstring &model, const pstring &entity)
bool err(false); bool err(false);
auto val = plib::pstonum_ne<nl_fptype>(tmp, err); auto val = plib::pstonum_ne<nl_fptype>(tmp, err);
if (err) if (err)
throw nl_exception(MF_MODEL_NUMBER_CONVERSION_ERROR(entity, tmp, "double", model)); plib::pthrow<nl_exception>(MF_MODEL_NUMBER_CONVERSION_ERROR(entity, tmp, "double", model));
return val * factor; return val * factor;
} }

View File

@ -61,7 +61,7 @@ namespace netlist
COPYASSIGNMOVE(callbacks_t, default) COPYASSIGNMOVE(callbacks_t, default)
/* logging callback */ /* logging callback */
virtual void vlog(const plib::plog_level &l, const pstring &ls) const = 0; virtual void vlog(const plib::plog_level &l, const pstring &ls) const noexcept = 0;
}; };

View File

@ -114,7 +114,7 @@ namespace plib
{ {
C nz = 0; C nz = 0;
if (nz_num != 0) if (nz_num != 0)
throw pexception("build_from_mat only allowed on empty CR matrix"); pthrow<pexception>("build_from_mat only allowed on empty CR matrix");
for (std::size_t k=0; k < size(); k++) for (std::size_t k=0; k < size(); k++)
{ {
row_idx[k] = nz; row_idx[k] = nz;
@ -189,7 +189,7 @@ namespace plib
while (col_idx[dp] < src.col_idx[sp]) while (col_idx[dp] < src.col_idx[sp])
A[dp++] = 0; A[dp++] = 0;
if (row_idx[r+1] <= dp || col_idx[dp] != src.col_idx[sp]) if (row_idx[r+1] <= dp || col_idx[dp] != src.col_idx[sp])
throw plib::pexception("slim_copy_from error"); pthrow<pexception>("slim_copy_from error");
A[dp++] = src.A[sp]; A[dp++] = src.A[sp];
} }
/* fill remaining elements in row */ /* fill remaining elements in row */

View File

@ -82,7 +82,7 @@ namespace plib {
{ {
if ((SIZE < 0 && size > SIZEABS()) if ((SIZE < 0 && size > SIZEABS())
|| (SIZE > 0 && size != SIZEABS())) || (SIZE > 0 && size != SIZEABS()))
throw plib::pexception("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE)); pthrow<pexception>("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE));
} }
template <int X = SIZE > template <int X = SIZE >
@ -91,7 +91,7 @@ namespace plib {
{ {
if ((SIZE < 0 && size > SIZEABS()) if ((SIZE < 0 && size > SIZEABS())
|| (SIZE > 0 && size != SIZEABS())) || (SIZE > 0 && size != SIZEABS()))
throw plib::pexception("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE)); pthrow<plib::pexception>("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE));
m_a.fill(val); m_a.fill(val);
} }

View File

@ -79,16 +79,16 @@ namespace plib {
bool err(false); bool err(false);
rc.m_param = plib::pstonum_ne<decltype(rc.m_param)>(cmd, err); rc.m_param = plib::pstonum_ne<decltype(rc.m_param)>(cmd, err);
if (err) if (err)
throw plib::pexception(plib::pfmt("pfunction: unknown/misformatted token <{1}> in <{2}>")(cmd)(expr)); pthrow<pexception>(plib::pfmt("pfunction: unknown/misformatted token <{1}> in <{2}>")(cmd)(expr));
stk += 1; stk += 1;
} }
} }
if (stk < 1) if (stk < 1)
throw plib::pexception(plib::pfmt("pfunction: stack underflow on token <{1}> in <{2}>")(cmd)(expr)); pthrow<pexception>(plib::pfmt("pfunction: stack underflow on token <{1}> in <{2}>")(cmd)(expr));
m_precompiled.push_back(rc); m_precompiled.push_back(rc);
} }
if (stk != 1) if (stk != 1)
throw plib::pexception(plib::pfmt("pfunction: stack count different to one on <{2}>")(expr)); pthrow<pexception>(plib::pfmt("pfunction: stack count different to one on <{2}>")(expr));
} }
static int get_prio(const pstring &v) static int get_prio(const pstring &v)
@ -110,7 +110,7 @@ namespace plib {
static pstring pop_check(std::stack<pstring> &stk, const pstring &expr) static pstring pop_check(std::stack<pstring> &stk, const pstring &expr)
{ {
if (stk.size() == 0) if (stk.size() == 0)
throw plib::pexception(plib::pfmt("pfunction: stack underflow during infix parsing of: <{1}>")(expr)); pthrow<pexception>(plib::pfmt("pfunction: stack underflow during infix parsing of: <{1}>")(expr));
pstring res = stk.top(); pstring res = stk.top();
stk.pop(); stk.pop();
return res; return res;

View File

@ -82,7 +82,7 @@ namespace plib {
{ {
if (m_other_args != nullptr) if (m_other_args != nullptr)
{ {
throw pexception("other args can only be specified once!"); pthrow<pexception>("other args can only be specified once!");
} }
else else
{ {
@ -90,7 +90,7 @@ namespace plib {
} }
} }
else else
throw pexception("found option with neither short or long tag!" ); pthrow<pexception>("found option with neither short or long tag!" );
} }
} }
} }

View File

@ -67,7 +67,7 @@ namespace plib {
s = trail + plib::pfmt("{1}:{2}:0\n")(m_stack.back().m_name, m_stack.back().m_lineno) + s; s = trail + plib::pfmt("{1}:{2}:0\n")(m_stack.back().m_name, m_stack.back().m_lineno) + s;
m_stack.pop_back(); m_stack.pop_back();
} }
throw pexception("\n" + s + e + " " + m_line + "\n"); pthrow<pexception>("\n" + s + e + " " + m_line + "\n");
} }
template <typename PP, typename L = ppreprocessor::string_list> template <typename PP, typename L = ppreprocessor::string_list>

View File

@ -106,11 +106,11 @@ namespace plib
//&& (ret == T(0) || plib::abs(ret) >= std::numeric_limits<T>::min() )) //&& (ret == T(0) || plib::abs(ret) >= std::numeric_limits<T>::min() ))
{ {
if (cstr[idx] != 0) if (cstr[idx] != 0)
throw pexception(pstring("Continuation after numeric value ends: ") + pstring(cstr)); pthrow<pexception>(pstring("Continuation after numeric value ends: ") + pstring(cstr));
} }
else else
{ {
throw pexception(pstring("Out of range: ") + pstring(cstr)); pthrow<pexception>(pstring("Out of range: ") + pstring(cstr));
} }
return static_cast<T>(ret); return static_cast<T>(ret);
} }

View File

@ -113,6 +113,7 @@ public:
pstring_t(C (&string)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays) pstring_t(C (&string)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
{ {
static_assert(N > 0,"pstring from array of length 0"); static_assert(N > 0,"pstring from array of length 0");
// need std::exception since pexception depends on pstring
if (string[N-1] != 0) if (string[N-1] != 0)
throw std::exception(); throw std::exception();
m_str.assign(string, N - 1); m_str.assign(string, N - 1);

View File

@ -181,7 +181,7 @@ public:
, m_app(app) , m_app(app)
{ } { }
void vlog(const plib::plog_level &l, const pstring &ls) const override; void vlog(const plib::plog_level &l, const pstring &ls) const noexcept override;
private: private:
tool_app_t &m_app; tool_app_t &m_app;
@ -266,7 +266,7 @@ public:
size += s->m_dt.size * s->m_count; size += s->m_dt.size * s->m_count;
if (buf.size() != size) if (buf.size() != size)
throw netlist::nl_exception("Size different during load state."); plib::pthrow<netlist::nl_exception>("Size different during load state.");
char *p = buf.data(); char *p = buf.data();
@ -288,7 +288,7 @@ protected:
private: private:
}; };
void netlist_tool_callbacks_t::vlog(const plib::plog_level &l, const pstring &ls) const void netlist_tool_callbacks_t::vlog(const plib::plog_level &l, const pstring &ls) const noexcept
{ {
pstring err = plib::pfmt("{}: {}\n")(l.name())(ls.c_str()); pstring err = plib::pfmt("{}: {}\n")(l.name())(ls.c_str());
if (l == plib::plog_level::WARNING) if (l == plib::plog_level::WARNING)
@ -296,12 +296,8 @@ void netlist_tool_callbacks_t::vlog(const plib::plog_level &l, const pstring &ls
if (l == plib::plog_level::ERROR) if (l == plib::plog_level::ERROR)
m_app.m_errors++; m_app.m_errors++;
if (l == plib::plog_level::FATAL) if (l == plib::plog_level::FATAL)
{
m_app.m_errors++; m_app.m_errors++;
throw netlist::nl_exception(err); m_app.pout("{}", err);
}
else
m_app.pout("{}", err);
} }
struct input_t struct input_t
@ -316,7 +312,7 @@ struct input_t
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
int e = std::sscanf(line.c_str(), "%lf,%[^,],%lf", &t, buf.data(), &val); int e = std::sscanf(line.c_str(), "%lf,%[^,],%lf", &t, buf.data(), &val);
if (e != 3) if (e != 3)
throw netlist::nl_exception(plib::pfmt("error {1} scanning line {2}\n")(e)(line)); plib::pthrow<netlist::nl_exception>(plib::pfmt("error {1} scanning line {2}\n")(e)(line));
m_value = static_cast<nl_fptype>(val); m_value = static_cast<nl_fptype>(val);
m_time = netlist::netlist_time::from_fp(t); m_time = netlist::netlist_time::from_fp(t);
m_param = setup.find_param(pstring(buf.data()), true); m_param = setup.find_param(pstring(buf.data()), true);
@ -328,7 +324,7 @@ struct input_t
{ {
case netlist::param_t::STRING: case netlist::param_t::STRING:
case netlist::param_t::POINTER: case netlist::param_t::POINTER:
throw netlist::nl_exception(plib::pfmt("param {1} is not numeric\n")(m_param->name())); plib::pthrow<netlist::nl_exception>(plib::pfmt("param {1} is not numeric\n")(m_param->name()));
case netlist::param_t::DOUBLE: case netlist::param_t::DOUBLE:
static_cast<netlist::param_fp_t*>(m_param)->setTo(m_value); static_cast<netlist::param_fp_t*>(m_param)->setTo(m_value);
break; break;
@ -353,7 +349,7 @@ static std::vector<input_t> read_input(const netlist::setup_t &setup, const pstr
{ {
plib::putf8_reader r = plib::putf8_reader(std::ifstream(plib::filesystem::u8path(fname))); plib::putf8_reader r = plib::putf8_reader(std::ifstream(plib::filesystem::u8path(fname)));
if (r.stream().fail()) if (r.stream().fail())
throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(fname)); plib::pthrow<netlist::nl_exception>(netlist::MF_FILE_OPEN_ERROR(fname));
r.stream().imbue(std::locale::classic()); r.stream().imbue(std::locale::classic());
pstring l; pstring l;
while (r.readline(l)) while (r.readline(l))
@ -410,7 +406,7 @@ void tool_app_t::run()
{ {
std::ifstream strm(plib::filesystem::u8path(opt_loadstate())); std::ifstream strm(plib::filesystem::u8path(opt_loadstate()));
if (strm.fail()) if (strm.fail())
throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(opt_loadstate())); plib::pthrow<netlist::nl_exception>(netlist::MF_FILE_OPEN_ERROR(opt_loadstate()));
strm.imbue(std::locale::classic()); strm.imbue(std::locale::classic());
plib::pbinary_reader reader(strm); plib::pbinary_reader reader(strm);
std::vector<char> loadstate; std::vector<char> loadstate;
@ -448,7 +444,7 @@ void tool_app_t::run()
auto savestate = nt.save_state(); auto savestate = nt.save_state();
std::ofstream strm(plib::filesystem::u8path(opt_savestate()), std::ios_base::binary); std::ofstream strm(plib::filesystem::u8path(opt_savestate()), std::ios_base::binary);
if (strm.fail()) if (strm.fail())
throw plib::file_open_e(opt_savestate()); plib::pthrow<plib::file_open_e>(opt_savestate());
strm.imbue(std::locale::classic()); strm.imbue(std::locale::classic());
plib::pbinary_writer writer(strm); plib::pbinary_writer writer(strm);
@ -496,14 +492,14 @@ void tool_app_t::validate()
//pout("Validation errors: {}\n", m_errors); //pout("Validation errors: {}\n", m_errors);
if (m_warnings + m_errors > 0) if (m_warnings + m_errors > 0)
throw netlist::nl_exception("validation: {1} errors {2} warnings", m_errors, m_warnings); plib::pthrow<netlist::nl_exception>("validation: {1} errors {2} warnings", m_errors, m_warnings);
} }
void tool_app_t::static_compile() void tool_app_t::static_compile()
{ {
if (!opt_dir.was_specified()) if (!opt_dir.was_specified())
throw netlist::nl_exception("--dir option needs to be specified"); plib::pthrow<netlist::nl_exception>("--dir option needs to be specified");
netlist_tool_t nt(*this, "netlist"); netlist_tool_t nt(*this, "netlist");
@ -763,7 +759,7 @@ void tool_app_t::convert()
{ {
std::ifstream strm(plib::filesystem::u8path(opt_file())); std::ifstream strm(plib::filesystem::u8path(opt_file()));
if (strm.fail()) if (strm.fail())
throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(opt_file())); plib::pthrow<netlist::nl_exception>(netlist::MF_FILE_OPEN_ERROR(opt_file()));
strm.imbue(std::locale::classic()); strm.imbue(std::locale::classic());
plib::copystream(ostrm, strm); plib::copystream(ostrm, strm);
} }

View File

@ -533,7 +533,7 @@ int nlwav_app::execute()
{ {
auto outstrm(std::ofstream(plib::filesystem::u8path(opt_out()))); auto outstrm(std::ofstream(plib::filesystem::u8path(opt_out())));
if (outstrm.fail()) if (outstrm.fail())
throw plib::file_open_e(opt_out()); plib::pthrow<plib::file_open_e>(opt_out());
outstrm.imbue(std::locale::classic()); outstrm.imbue(std::locale::classic());
convert(outstrm); convert(outstrm);
} }