From d48cfadb3d8f4ce667e03c7df53866a7f5f43a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 10 Dec 2023 21:17:27 +0100 Subject: [PATCH] fix catching eval errors on macOS --- src/worker.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/worker.cc b/src/worker.cc index a1aa293..42d4d73 100644 --- a/src/worker.cc +++ b/src/worker.cc @@ -153,6 +153,12 @@ void worker(nix::ref state, nix::Bindings &autoArgs, // Don't forget to print it into the STDERR log, this is // what's shown in the Hydra UI. fprintf(stderr, "%s\n", msg.c_str()); + } catch ( + const std::exception &e) { // FIXME: for some reason the catch block + // above, doesn't trigger on macOS (?) + auto msg = e.what(); + reply["error"] = nix::filterANSIEscapes(msg, true); + fprintf(stderr, "%s\n", msg); } if (tryWriteLine(to.get(), reply.dump()) < 0) {