This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  8e85244   Log the Lua error message when evaluating metrics fails.
8e85244 is described below

commit 8e8524498610cfb3e3b6ada025021a1b5ca27643
Author: scw00 <[email protected]>
AuthorDate: Wed May 24 16:12:00 2017 +0800

    Log the Lua error message when evaluating metrics fails.
---
 cmd/traffic_manager/metrics.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmd/traffic_manager/metrics.cc b/cmd/traffic_manager/metrics.cc
index 988cce7..f06d5a5 100644
--- a/cmd/traffic_manager/metrics.cc
+++ b/cmd/traffic_manager/metrics.cc
@@ -46,6 +46,7 @@ struct Evaluator {
   bool
   bind(lua_State *L, const char *metric, const char *expression)
   {
+    const char *err = nullptr;
     if (RecGetRecordDataType(metric, &this->data_type) != REC_ERR_OKAY) {
       return false;
     }
@@ -55,8 +56,9 @@ struct Evaluator {
     switch (luaL_loadstring(L, expression)) {
     case LUA_ERRSYNTAX:
     case LUA_ERRMEM:
-      Debug("lua", "loadstring failed for %s", metric);
-      luaL_error(L, "invalid expression for %s", metric);
+      err = luaL_checkstring(L, -1);
+      Debug("lua", "loadstring failed for %s: %s", metric, err);
+      luaL_error(L, "invalid expression for %s: %s", metric, err);
       return false;
     case 0:
       break; // success

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to