*improved error prompting for wrong function reaching.

This commit is contained in:
Wang Renxin 2016-06-21 10:20:05 +08:00 committed by GitHub
parent e95a4121d6
commit b4129948a5

View File

@ -1341,14 +1341,23 @@ static void _on_error(struct mb_interpreter_t* s, mb_error_e e, char* m, char* f
mb_unrefvar(s); mb_unrefvar(s);
mb_unrefvar(p); mb_unrefvar(p);
if(SE_NO_ERR != e) { if(e != SE_NO_ERR) {
if(f) { if(f) {
_printf( if(e == SE_RN_WRONG_FUNCTION_REACHED) {
"Error:\n Line %d, Col %d in File: %s\n Code %d, Abort Code %d\n Message: %s.\n", _printf(
row, col, f, "Error:\n Line %d, Col %d in Func: %s\n Code %d, Abort Code %d\n Message: %s.\n",
e, e == SE_EA_EXTENDED_ABORT ? abort_code - MB_EXTENDED_ABORT : abort_code, row, col, f,
m e, abort_code,
); m
);
} else {
_printf(
"Error:\n Line %d, Col %d in File: %s\n Code %d, Abort Code %d\n Message: %s.\n",
row, col, f,
e, e == SE_EA_EXTENDED_ABORT ? abort_code - MB_EXTENDED_ABORT : abort_code,
m
);
}
} else { } else {
_printf( _printf(
"Error:\n Line %d, Col %d\n Code %d, Abort Code %d\n Message: %s.\n", "Error:\n Line %d, Col %d\n Code %d, Abort Code %d\n Message: %s.\n",