From 62f4b1532b3b55da5b46043da9d44138ce5e48c4 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 13 Sep 2017 18:25:00 +0200 Subject: [PATCH] Raise Out_of_memory when Augeas fails with AUG_ENOMEM This is more in style with what OCaml reports in this kind of situations. --- augeas-c.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/augeas-c.c b/augeas-c.c index 7ca7244..5c330a8 100644 --- a/augeas-c.c +++ b/augeas-c.c @@ -35,6 +35,11 @@ typedef augeas *augeas_t; static void raise_error (augeas_t t, const char *msg) { + const int code = aug_error (t); + + if (code == AUG_ENOMEM) + caml_raise_out_of_memory (); + caml_raise_with_string (*caml_named_value ("Augeas.Error"), msg); } -- 1.8.3.1