[augeas-devel] [PATCH 1 of 3] Minor error message improvements

David Lutterkort lutter at redhat.com
Tue Sep 2 23:08:55 UTC 2008


2 files changed, 6 insertions(+), 1 deletion(-)
src/builtin.c |    5 +++++
src/put.c     |    2 +-


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1220396331 25200
# Node ID 495e0d2486712b7db2edb56819cd4b9a6f74ea78
# Parent  09dcb70fa72447aab1aabd9ca28d2d32f6b2c547
Minor error message improvements

- Include information about the lens that produced the error if it's
  available
- When a union during 'put' does not match, produce an error instead of
  aborting

diff -r 09dcb70fa724 -r 495e0d248671 src/builtin.c
--- a/src/builtin.c	Thu Aug 28 21:38:11 2008 -0700
+++ b/src/builtin.c	Tue Sep 02 15:58:51 2008 -0700
@@ -82,6 +82,11 @@
     struct value *v;
 
     v = make_exn_value(ref(info), "%s", err->message);
+    if (err->lens != NULL) {
+        char *s = format_info(err->lens->info);
+        exn_printf_line(v, "Lens: %s", s);
+        free(s);
+    }
     if (err->pos >= 0) {
         char *pos = format_pos(text, err->pos);
         exn_printf_line(v,
diff -r 09dcb70fa724 -r 495e0d248671 src/put.c
--- a/src/put.c	Thu Aug 28 21:38:11 2008 -0700
+++ b/src/put.c	Tue Sep 02 15:58:51 2008 -0700
@@ -435,7 +435,7 @@
             return;
         }
     }
-    assert(0);
+    put_error(state, lens, "None of the alternatives in the union match");
 }
 
 static void put_concat(struct lens *lens, struct state *state) {




More information about the augeas-devel mailing list