improved error handling a bit
This commit is contained in:
parent
3c6b73b2b5
commit
9f27e27d25
@ -227,7 +227,7 @@ static moo_oop_association_t lookup (moo_t* moo, moo_oop_dic_t dic, const moo_oo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* when value is MOO_NULL, perform no insertion */
|
/* when value is MOO_NULL, perform no insertion */
|
||||||
moo_seterrnum (moo, MOO_ENOENT);
|
moo_seterrbfmt (moo, MOO_ENOENT, "unable to find %.*js in a dictionary", name->len, name->ptr);
|
||||||
return MOO_NULL;
|
return MOO_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
298
moo/lib/exec.c
298
moo/lib/exec.c
File diff suppressed because it is too large
Load Diff
@ -2023,6 +2023,7 @@ static int handle_logopt (moo_t* moo, const moo_bch_t* str)
|
|||||||
if (cm) *cm = '\0';
|
if (cm) *cm = '\0';
|
||||||
|
|
||||||
if (moo_compbcstr(flt, "app") == 0) xtn->logmask |= MOO_LOG_APP;
|
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, "mnemonic") == 0) xtn->logmask |= MOO_LOG_MNEMONIC;
|
||||||
else if (moo_compbcstr(flt, "gc") == 0) xtn->logmask |= MOO_LOG_GC;
|
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, "ic") == 0) xtn->logmask |= MOO_LOG_IC;
|
||||||
@ -2318,7 +2319,7 @@ int main (int argc, char* argv[])
|
|||||||
mthname.len = 4;
|
mthname.len = 4;
|
||||||
if (moo_invoke (moo, &objname, &mthname) <= -1)
|
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;
|
xret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1413,15 +1413,15 @@ enum moo_log_mask_t
|
|||||||
MOO_LOG_ERROR = (1 << 3),
|
MOO_LOG_ERROR = (1 << 3),
|
||||||
MOO_LOG_FATAL = (1 << 4),
|
MOO_LOG_FATAL = (1 << 4),
|
||||||
|
|
||||||
|
MOO_LOG_VM = (1 << 6),
|
||||||
MOO_LOG_MNEMONIC = (1 << 7), /* bytecode mnemonic */
|
MOO_LOG_MNEMONIC = (1 << 7), /* bytecode mnemonic */
|
||||||
MOO_LOG_GC = (1 << 8),
|
MOO_LOG_GC = (1 << 8),
|
||||||
MOO_LOG_IC = (1 << 9), /* instruction cycle, fetch-decode-execute */
|
MOO_LOG_IC = (1 << 9), /* instruction cycle, fetch-decode-execute */
|
||||||
MOO_LOG_PRIMITIVE = (1 << 10),
|
MOO_LOG_PRIMITIVE = (1 << 10),
|
||||||
MOO_LOG_APP = (1 << 11), /* moo applications, set by moo logging primitive */
|
MOO_LOG_APP = (1 << 11), /* moo applications, set by moo logging primitive */
|
||||||
|
|
||||||
|
|
||||||
MOO_LOG_ALL_LEVELS = (MOO_LOG_DEBUG | MOO_LOG_INFO | MOO_LOG_WARN | MOO_LOG_ERROR | MOO_LOG_FATAL),
|
MOO_LOG_ALL_LEVELS = (MOO_LOG_DEBUG | MOO_LOG_INFO | MOO_LOG_WARN | MOO_LOG_ERROR | MOO_LOG_FATAL),
|
||||||
MOO_LOG_ALL_TYPES = (MOO_LOG_MNEMONIC | MOO_LOG_GC | MOO_LOG_IC | MOO_LOG_PRIMITIVE | MOO_LOG_APP),
|
MOO_LOG_ALL_TYPES = (MOO_LOG_VM | MOO_LOG_MNEMONIC | MOO_LOG_GC | MOO_LOG_IC | MOO_LOG_PRIMITIVE | MOO_LOG_APP),
|
||||||
|
|
||||||
|
|
||||||
MOO_LOG_STDOUT = (1 << 14), /* write log messages to stdout without timestamp. MOO_LOG_STDOUT wins over MOO_LOG_STDERR. */
|
MOO_LOG_STDOUT = (1 << 14), /* write log messages to stdout without timestamp. MOO_LOG_STDOUT wins over MOO_LOG_STDERR. */
|
||||||
|
Loading…
Reference in New Issue
Block a user