r1290 - trunk/varnish-cache/lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Sat Mar 31 09:43:05 CEST 2007


Author: phk
Date: 2007-03-31 09:43:05 +0200 (Sat, 31 Mar 2007)
New Revision: 1290

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_compile.c
   trunk/varnish-cache/lib/libvcl/vcc_token.c
Log:
Improve error message layout and information.


Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.c	2007-03-30 21:11:15 UTC (rev 1289)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.c	2007-03-31 07:43:05 UTC (rev 1290)
@@ -395,21 +395,20 @@
 	if (u) {
 #define VCL_RET_MAC(a, b, c, d) \
 		if (u & VCL_RET_##b) { \
-			vsb_printf(tl->sb, "Illegal return for method\n"); \
+			vsb_printf(tl->sb, "Illegal action \"%s\"\n", #a); \
 			vcc_ErrWhere(tl, p->returnt[d]); \
 		}
 #include "vcl_returns.h"
 #undef VCL_RET_MAC
-		vsb_printf(tl->sb, "In function\n");
+		vsb_printf(tl->sb, "\n...in function \"%.*s\"\n", PF(p->name));
 		vcc_ErrWhere(tl, p->name);
 		return (1);
 	}
 	p->active = 1;
 	TAILQ_FOREACH(pc, &p->calls, list) {
 		if (Consist_Decend(tl, pc->p, returns)) {
-			vsb_printf(tl->sb, "\nCalled from\n");
-			vcc_ErrWhere(tl, p->name);
-			vsb_printf(tl->sb, "at\n");
+			vsb_printf(tl->sb, "\n...called from \"%.*s\"\n",
+			    PF(p->name));
 			vcc_ErrWhere(tl, pc->t);
 			return (1);
 		}
@@ -434,7 +433,16 @@
 			continue;
 		if (Consist_Decend(tl, p, m->returns)) {
 			vsb_printf(tl->sb,
-			    "\nwhich is a %s method\n", m->name);
+			    "\n...which is the \"%s\" method\n", m->name);
+			vsb_printf(tl->sb, "Legal actions are:");
+#define VCL_RET_MAC(a, b, c, d) \
+			if (m->returns & c) \
+				vsb_printf(tl->sb, " \"%s\"", #a);
+#define VCL_RET_MAC_E(a, b, c, d) VCL_RET_MAC(a, b, c, d)
+#include "vcl_returns.h"
+#undef VCL_RET_MAC
+#undef VCL_RET_MAC_E
+			vsb_printf(tl->sb, "\n");
 			return (1);
 		}
 	}

Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_token.c	2007-03-30 21:11:15 UTC (rev 1289)
+++ trunk/varnish-cache/lib/libvcl/vcc_token.c	2007-03-31 07:43:05 UTC (rev 1290)
@@ -91,7 +91,7 @@
 		} else
 			pos++;
 	}
-	vsb_printf(tl->sb, "In %s Line %d Pos %d\n", f, lin, pos);
+	vsb_printf(tl->sb, "(%s Line %d Pos %d)\n", f, lin, pos);
 	x = y = 0;
 	for (p = l; p < e && *p != '\n'; p++) {
 		if (*p == '\t') {




More information about the varnish-commit mailing list