Use new error handler in modules.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2018-09-03 20:19:12 +02:00
parent d85a517eb0
commit bd44dba33c
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 12 additions and 12 deletions

View File

@ -613,7 +613,7 @@ static sxi32 VmJsonDecode(
/* Scalar value */ /* Scalar value */
pWorker = ph7_context_new_scalar(pDecoder->pCtx); pWorker = ph7_context_new_scalar(pDecoder->pCtx);
if(pWorker == 0) { if(pWorker == 0) {
ph7_context_throw_error(pDecoder->pCtx, PH7_CTX_ERR, "PH7 is running out of memory"); PH7_VmMemoryError(pDecoder->pCtx->pVm);
/* Abort the decoding operation immediately */ /* Abort the decoding operation immediately */
return SXERR_ABORT; return SXERR_ABORT;
} }
@ -653,7 +653,7 @@ static sxi32 VmJsonDecode(
/* Create a working array */ /* Create a working array */
pWorker = ph7_context_new_array(pDecoder->pCtx); pWorker = ph7_context_new_array(pDecoder->pCtx);
if(pWorker == 0) { if(pWorker == 0) {
ph7_context_throw_error(pDecoder->pCtx, PH7_CTX_ERR, "PH7 is running out of memory"); PH7_VmMemoryError(pDecoder->pCtx->pVm);
/* Abort the decoding operation immediately */ /* Abort the decoding operation immediately */
return SXERR_ABORT; return SXERR_ABORT;
} }
@ -706,7 +706,7 @@ static sxi32 VmJsonDecode(
pDecoder->pIn++; pDecoder->pIn++;
/* Return the object as an associative array */ /* Return the object as an associative array */
if((pDecoder->iFlags & JSON_DECODE_ASSOC) == 0) { if((pDecoder->iFlags & JSON_DECODE_ASSOC) == 0) {
ph7_context_throw_error(pDecoder->pCtx, PH7_CTX_WARNING, PH7_VmGenericError(pDecoder->pCtx->pVm, PH7_CTX_WARNING,
"JSON Objects are always returned as an associative array" "JSON Objects are always returned as an associative array"
); );
} }
@ -714,7 +714,7 @@ static sxi32 VmJsonDecode(
pWorker = ph7_context_new_array(pDecoder->pCtx); pWorker = ph7_context_new_array(pDecoder->pCtx);
pKey = ph7_context_new_scalar(pDecoder->pCtx); pKey = ph7_context_new_scalar(pDecoder->pCtx);
if(pWorker == 0 || pKey == 0) { if(pWorker == 0 || pKey == 0) {
ph7_context_throw_error(pDecoder->pCtx, PH7_CTX_ERR, "PH7 is running out of memory"); PH7_VmMemoryError(pDecoder->pCtx->pVm);
/* Abort the decoding operation immediately */ /* Abort the decoding operation immediately */
return SXERR_ABORT; return SXERR_ABORT;
} }

View File

@ -284,7 +284,7 @@ static int vm_builtin_xml_parser_create(ph7_context *pCtx, int nArg, ph7_value *
/* Allocate a new instance */ /* Allocate a new instance */
pEngine = VmCreateXMLEngine(&(*pCtx), 0, ':'); pEngine = VmCreateXMLEngine(&(*pCtx), 0, ':');
if(pEngine == 0) { if(pEngine == 0) {
ph7_context_throw_error(pCtx, PH7_CTX_ERR, "PH7 is running out of memory"); PH7_VmMemoryError(pCtx->pVm);
/* Return null */ /* Return null */
ph7_result_null(pCtx); ph7_result_null(pCtx);
SXUNUSED(nArg); /* cc warning */ SXUNUSED(nArg); /* cc warning */
@ -318,7 +318,7 @@ static int vm_builtin_xml_parser_create_ns(ph7_context *pCtx, int nArg, ph7_valu
/* Allocate a new instance */ /* Allocate a new instance */
pEngine = VmCreateXMLEngine(&(*pCtx), TRUE, ns_sep); pEngine = VmCreateXMLEngine(&(*pCtx), TRUE, ns_sep);
if(pEngine == 0) { if(pEngine == 0) {
ph7_context_throw_error(pCtx, PH7_CTX_ERR, "PH7 is running out of memory"); PH7_VmMemoryError(pCtx->pVm);
/* Return null */ /* Return null */
ph7_result_null(pCtx); ph7_result_null(pCtx);
return PH7_OK; return PH7_OK;
@ -877,7 +877,7 @@ static int vm_builtin_xml_set_object(ph7_context *pCtx, int nArg, ph7_value **ap
return PH7_OK; return PH7_OK;
} }
/* Throw a notice and return */ /* Throw a notice and return */
ph7_context_throw_error(pCtx, PH7_CTX_NOTICE, "This function is depreceated and is a no-op." PH7_VmGenericError(pCtx->pVm, PH7_CTX_DEPRECATED, "This function is deprecated and is a no-op."
"In order to mimic this behaviour,you can supply instead of a function name an array " "In order to mimic this behaviour,you can supply instead of a function name an array "
"containing an object reference and a method name." "containing an object reference and a method name."
); );
@ -969,7 +969,7 @@ static ph7_value *VmXMLValue(ph7_xml_engine *pEngine, SyXMLRawStr *pXML, SyXMLRa
/* Allocate a new scalar variable */ /* Allocate a new scalar variable */
pValue = ph7_context_new_scalar(pEngine->pCtx); pValue = ph7_context_new_scalar(pEngine->pCtx);
if(pValue == 0) { if(pValue == 0) {
ph7_context_throw_error(pEngine->pCtx, PH7_CTX_ERR, "PH7 is running out of memory"); PH7_VmMemoryError(pEngine->pCtx->pVm);
return 0; return 0;
} }
if(pNsUri && pNsUri->nByte > 0) { if(pNsUri && pNsUri->nByte > 0) {
@ -989,7 +989,7 @@ static ph7_value *VmXMLAttrValue(ph7_xml_engine *pEngine, SyXMLRawStr *aAttr, sx
/* Create an empty array */ /* Create an empty array */
pArray = ph7_context_new_array(pEngine->pCtx); pArray = ph7_context_new_array(pEngine->pCtx);
if(pArray == 0) { if(pArray == 0) {
ph7_context_throw_error(pEngine->pCtx, PH7_CTX_ERR, "PH7 is running out of memory"); PH7_VmMemoryError(pEngine->pCtx->pVm);
return 0; return 0;
} }
if(nAttr > 0) { if(nAttr > 0) {
@ -999,7 +999,7 @@ static ph7_value *VmXMLAttrValue(ph7_xml_engine *pEngine, SyXMLRawStr *aAttr, sx
pKey = ph7_context_new_scalar(pEngine->pCtx); pKey = ph7_context_new_scalar(pEngine->pCtx);
pValue = ph7_context_new_scalar(pEngine->pCtx); pValue = ph7_context_new_scalar(pEngine->pCtx);
if(pKey == 0 || pValue == 0) { if(pKey == 0 || pValue == 0) {
ph7_context_throw_error(pEngine->pCtx, PH7_CTX_ERR, "PH7 is running out of memory"); PH7_VmMemoryError(pEngine->pCtx->pVm);
return 0; return 0;
} }
/* Copy attributes */ /* Copy attributes */
@ -1295,8 +1295,8 @@ static int vm_builtin_xml_parse(ph7_context *pCtx, int nArg, ph7_value **apArg)
/* This can happen when the user callback call xml_parse() again /* This can happen when the user callback call xml_parse() again
* in it's body which is forbidden. * in it's body which is forbidden.
*/ */
ph7_context_throw_error_format(pCtx, PH7_CTX_ERR, PH7_VmGenericError(pCtx->pVm, PH7_CTX_WARNING,
"Recursive call to %s,PH7 is returning false", "Recursive call to %s, PH7 is returning false",
ph7_function_name(pCtx) ph7_function_name(pCtx)
); );
/* Return FALSE */ /* Return FALSE */