improved error handling a bit

This commit is contained in:
hyunghwan.chung
2017-12-27 10:32:57 +00:00
parent 3c6b73b2b5
commit 9f27e27d25
5 changed files with 180 additions and 165 deletions

View File

@ -2022,11 +2022,12 @@ static int handle_logopt (moo_t* moo, const moo_bch_t* str)
cm = moo_findbcharinbcstr(flt, ',');
if (cm) *cm = '\0';
if (moo_compbcstr (flt, "app") == 0) xtn->logmask |= MOO_LOG_APP;
else if (moo_compbcstr (flt, "mnemonic") == 0) xtn->logmask |= MOO_LOG_MNEMONIC;
else if (moo_compbcstr (flt, "gc") == 0) xtn->logmask |= MOO_LOG_GC;
else if (moo_compbcstr (flt, "ic") == 0) xtn->logmask |= MOO_LOG_IC;
else if (moo_compbcstr (flt, "primitive") == 0) xtn->logmask |= MOO_LOG_PRIMITIVE;
if (moo_compbcstr(flt, "app") == 0) xtn->logmask |= MOO_LOG_APP;
else if (moo_compbcstr(flt, "vm") == 0) xtn->logmask |= MOO_LOG_VM;
else if (moo_compbcstr(flt, "mnemonic") == 0) xtn->logmask |= MOO_LOG_MNEMONIC;
else if (moo_compbcstr(flt, "gc") == 0) xtn->logmask |= MOO_LOG_GC;
else if (moo_compbcstr(flt, "ic") == 0) xtn->logmask |= MOO_LOG_IC;
else if (moo_compbcstr(flt, "primitive") == 0) xtn->logmask |= MOO_LOG_PRIMITIVE;
}
while (cm);
@ -2318,7 +2319,7 @@ int main (int argc, char* argv[])
mthname.len = 4;
if (moo_invoke (moo, &objname, &mthname) <= -1)
{
moo_logbfmt (moo, MOO_LOG_ERROR, "ERROR: cannot execute code - [%d] %js\n", moo_geterrnum(moo), moo_geterrstr(moo));
moo_logbfmt (moo, MOO_LOG_ERROR, "ERROR: cannot execute code - [%d] %js\n", moo_geterrnum(moo), moo_geterrmsg(moo));
xret = -1;
}