{
struct hlua_function *fcn = (struct hlua_function *)private;
struct stream *stream = smp->strm;
+ const char *error;
if (!stream)
return 0;
/* The following Lua calls can fail. */
if (!SET_SAFE_LJMP(stream->hlua.T)) {
- SEND_ERR(stream->be, "Lua converter '%s': critical error.\n", fcn->name);
+ if (lua_type(stream->hlua.T, -1) == LUA_TSTRING)
+ error = lua_tostring(stream->hlua.T, -1);
+ else
+ error = "critical error";
+ SEND_ERR(stream->be, "Lua converter '%s': %s.\n", fcn->name, error);
return 0;
}
{
struct hlua_function *fcn = (struct hlua_function *)private;
struct stream *stream = smp->strm;
+ const char *error;
if (!stream)
return 0;
/* The following Lua calls can fail. */
if (!SET_SAFE_LJMP(stream->hlua.T)) {
- SEND_ERR(smp->px, "Lua sample-fetch '%s': critical error.\n", fcn->name);
+ if (lua_type(stream->hlua.T, -1) == LUA_TSTRING)
+ error = lua_tostring(stream->hlua.T, -1);
+ else
+ error = "critical error";
+ SEND_ERR(smp->px, "Lua sample-fetch '%s': %s.\n", fcn->name, error);
return 0;
}
char **arg;
unsigned int analyzer;
int dir;
+ const char *error;
switch (rule->from) {
case ACT_F_TCP_REQ_CNT: analyzer = AN_REQ_INSPECT_FE ; dir = SMP_OPT_DIR_REQ; break;
/* The following Lua calls can fail. */
if (!SET_SAFE_LJMP(s->hlua.T)) {
- SEND_ERR(px, "Lua function '%s': critical error.\n",
- rule->arg.hlua_rule->fcn.name);
+ if (lua_type(s->hlua.T, -1) == LUA_TSTRING)
+ error = lua_tostring(s->hlua.T, -1);
+ else
+ error = "critical error";
+ SEND_ERR(px, "Lua function '%s': %s.\n",
+ rule->arg.hlua_rule->fcn.name, error);
return ACT_RET_CONT;
}
struct hlua *hlua = &ctx->ctx.hlua_apptcp.hlua;
struct task *task;
char **arg;
+ const char *error;
HLUA_INIT(hlua);
ctx->ctx.hlua_apptcp.flags = 0;
/* The following Lua calls can fail. */
if (!SET_SAFE_LJMP(hlua->T)) {
- SEND_ERR(px, "Lua applet tcp '%s': critical error.\n",
- ctx->rule->arg.hlua_rule->fcn.name);
+ if (lua_type(hlua->T, -1) == LUA_TSTRING)
+ error = lua_tostring(hlua->T, -1);
+ else
+ error = "critical error";
+ SEND_ERR(px, "Lua applet tcp '%s': %s.\n",
+ ctx->rule->arg.hlua_rule->fcn.name, error);
RESET_SAFE_LJMP(hlua->T);
return 0;
}
struct hdr_ctx hdr;
struct task *task;
struct sample smp; /* just used for a valid call to smp_prefetch_http. */
+ const char *error;
/* Wait for a full HTTP request. */
if (!smp_prefetch_http(px, strm, 0, NULL, &smp, 0)) {
/* The following Lua calls can fail. */
if (!SET_SAFE_LJMP(hlua->T)) {
- SEND_ERR(px, "Lua applet http '%s': critical error.\n",
- ctx->rule->arg.hlua_rule->fcn.name);
+ if (lua_type(hlua->T, -1) == LUA_TSTRING)
+ error = lua_tostring(hlua->T, -1);
+ else
+ error = "critical error";
+ SEND_ERR(px, "Lua applet http '%s': %s.\n",
+ ctx->rule->arg.hlua_rule->fcn.name, error);
return 0;
}
struct hlua_init_function *init;
const char *msg;
enum hlua_exec ret;
+ const char *error;
list_for_each_entry(init, &hlua_init_functions, l) {
lua_rawgeti(gL.T, LUA_REGISTRYINDEX, init->function_ref);
struct sample_fetch *sf;
struct sample_conv *sc;
char *p;
+ const char *error_msg;
#ifdef USE_OPENSSL
struct srv_kw *kw;
int tmp_error;
/* Set safe environment for the initialisation. */
if (!SET_SAFE_LJMP(gL.T)) {
- fprintf(stderr, "Lua init: critical error.\n");
+ if (lua_type(gL.T, -1) == LUA_TSTRING)
+ error_msg = lua_tostring(gL.T, -1);
+ else
+ error_msg = "critical error";
+ fprintf(stderr, "Lua init: %s.\n", error_msg);
exit(1);
}