[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] augeas: master - * src/builtin.c (lens_get, lens_put): propagate errors as exceptions



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=232fe557bdf3ce1f0149d941f3a55affb9e94f11
Commit:        232fe557bdf3ce1f0149d941f3a55affb9e94f11
Parent:        a801a2be5375da83106f19d4cfbd8dd985680c5c
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Fri Dec 18 16:05:54 2009 -0800
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Fri Dec 18 16:33:27 2009 -0800

* src/builtin.c (lens_get, lens_put): propagate errors as exceptions

---
 src/builtin.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/builtin.c b/src/builtin.c
index b311063..874ae76 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -29,6 +29,7 @@
 #include "syntax.h"
 #include "memory.h"
 #include "transform.h"
+#include "errcode.h"
 
 #define UNIMPL_BODY(name)                       \
     {                                           \
@@ -84,6 +85,9 @@ static struct value *make_exn_lns_error(struct info *info,
                                         const char *text) {
     struct value *v;
 
+    if (HAS_ERR(info))
+        return exn_error();
+
     v = make_exn_value(ref(info), "%s", err->message);
     if (err->lens != NULL) {
         char *s = format_info(err->lens->info);
@@ -147,7 +151,7 @@ static struct value *lens_get(struct info *info, struct value *l,
     const char *text = str->string->str;
 
     struct tree *tree = lns_get(info, l->lens, text, &err);
-    if (err == NULL) {
+    if (err == NULL && ! HAS_ERR(info)) {
         v = make_value(V_TREE, ref(info));
         v->origin = make_tree_origin(tree);
     } else {
@@ -184,7 +188,7 @@ static struct value *lens_put(struct info *info, struct value *l,
             str->string->str, &err);
     close_memstream(&ms);
 
-    if (err == NULL) {
+    if (err == NULL && ! HAS_ERR(info)) {
         v = make_value(V_STRING, ref(info));
         v->string = make_string(ms.buf);
     } else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]