From da4fa9bac7c9a64fc7f3c0e4e2256580d5cdde44 Mon Sep 17 00:00:00 2001 From: lazedo Date: Wed, 16 Sep 2020 02:13:52 +0100 Subject: [PATCH] [mod_expr] log errors --- src/mod/applications/mod_expr/mod_expr.c | 29 ++++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_expr/mod_expr.c b/src/mod/applications/mod_expr/mod_expr.c index 48a6421d00..3519d36086 100644 --- a/src/mod/applications/mod_expr/mod_expr.c +++ b/src/mod/applications/mod_expr/mod_expr.c @@ -83,13 +83,17 @@ SWITCH_STANDARD_API(expr_function) /* Create function list */ err = exprFuncListCreate(&f); - if (err != EXPR_ERROR_NOERROR) + if (err != EXPR_ERROR_NOERROR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CREATE FUNC LIST\n"); goto error; + } /* Init function list with internal functions */ err = exprFuncListInit(f); - if (err != EXPR_ERROR_NOERROR) + if (err != EXPR_ERROR_NOERROR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INIT FUNC LIST\n"); goto error; + } /* Add custom function */ //err = exprFuncListAdd(f, my_func, "myfunc", 1, 1, 1, 1); @@ -98,29 +102,39 @@ SWITCH_STANDARD_API(expr_function) /* Create constant list */ err = exprValListCreate(&c); - if (err != EXPR_ERROR_NOERROR) + if (err != EXPR_ERROR_NOERROR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CREATE CONST LIST\n"); goto error; + } /* Init constant list with internal constants */ err = exprValListInit(c); - if (err != EXPR_ERROR_NOERROR) + if (err != EXPR_ERROR_NOERROR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CREATE INTERNAL CONST LIST\n"); goto error; + } /* Create variable list */ err = exprValListCreate(&v); - if (err != EXPR_ERROR_NOERROR) + if (err != EXPR_ERROR_NOERROR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CREATE VARIABLE LIST\n"); goto error; + } /* Create expression object */ err = exprCreate(&e, f, v, c, breaker, NULL); - if (err != EXPR_ERROR_NOERROR) + if (err != EXPR_ERROR_NOERROR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "EXPR OBJECT\n"); goto error; + } /* Parse expression */ err = exprParse(e, (char *) expr); - if (err != EXPR_ERROR_NOERROR) + if (err != EXPR_ERROR_NOERROR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PARSE EXPR => %s\n", cmd); goto error; + } /* Enable soft errors */ //exprSetSoftErrors(e, 1); @@ -135,6 +149,7 @@ SWITCH_STANDARD_API(expr_function) } while (err && ec < 3); if (err) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "EXPR VAL\n"); goto error; }