Rework trigger_error() builtin function.
All checks were successful
The build was successful.

This commit is contained in:
Rafal Kupiec 2018-09-03 19:27:38 +02:00
parent 0a28e492a7
commit d85a517eb0
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4

View File

@ -8974,26 +8974,23 @@ static int vm_builtin_trigger_error(ph7_context *pCtx, int nArg, ph7_value **apA
/* Extract the error type */ /* Extract the error type */
nErr = ph7_value_to_int(apArg[1]); nErr = ph7_value_to_int(apArg[1]);
switch(nErr) { switch(nErr) {
case 1: /* E_ERROR */ case E_ERROR:
case 16: /* E_CORE_ERROR */
case 64: /* E_COMPILE_ERROR */
case 256: /* E_USER_ERROR */
nErr = PH7_CTX_ERR; nErr = PH7_CTX_ERR;
rc = PH7_ABORT; /* Abort processing immediately */ rc = PH7_ABORT;
break; break;
case 2: /* E_WARNING */ case E_WARNING:
case 32: /* E_CORE_WARNING */
case 123: /* E_COMPILE_WARNING */
case 512: /* E_USER_WARNING */
nErr = PH7_CTX_WARNING; nErr = PH7_CTX_WARNING;
break; break;
case E_DEPRECATED:
nErr = PH7_CTX_DEPRECATED;
break;
default: default:
nErr = PH7_CTX_NOTICE; nErr = PH7_CTX_NOTICE;
break; break;
} }
} }
/* Report error */ /* Report error */
ph7_context_throw_error_format(pCtx, nErr, "%.*s", nLen, zErr); PH7_VmGenericError(pCtx->pVm, nErr, "%.*s", nLen, zErr);
/* Return true */ /* Return true */
ph7_result_bool(pCtx, 1); ph7_result_bool(pCtx, 1);
} else { } else {