]> err.no Git - varnish/commitdiff
Improve error message layout and information.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 31 Mar 2007 07:43:05 +0000 (07:43 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 31 Mar 2007 07:43:05 +0000 (07:43 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1290 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/lib/libvcl/vcc_compile.c
varnish-cache/lib/libvcl/vcc_token.c

index 6bbfbd5e3701e12a86a6d992f744c78f1a3d5d27..6adc872388282dc2e690908164d5521d98ce8073 100644 (file)
@@ -395,21 +395,20 @@ Consist_Decend(struct tokenlist *tl, struct proc *p, unsigned returns)
        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 @@ Consistency(struct tokenlist *tl)
                        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);
                }
        }
index 5f16d448c42fe58e9c9a45fd0b91721d1a5d4cae..ca47c8e2b2ec47c6bcb36f11f557be1137a8fe95 100644 (file)
@@ -91,7 +91,7 @@ vcc_ErrWhere(struct tokenlist *tl, struct token *t)
                } 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') {