From 28e0742966e962f2672f5731ea3612f223bf3283 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 2 Oct 2013 14:34:36 +0200 Subject: Report OOM errors better --- src/libmain/shared.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/libmain/shared.cc') diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index ee0dccc9d..b71bca682 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -303,6 +303,9 @@ int main(int argc, char * * argv) if (e.prefix() != "" && !showTrace) printMsg(lvlError, "(use `--show-trace' to show detailed location information)"); return e.status; + } catch (std::bad_alloc & e) { + printMsg(lvlError, "error: out of memory"); + return 1; } catch (std::exception & e) { printMsg(lvlError, format("error: %1%") % e.what()); return 1; -- cgit v1.2.3