From 68d49789538f54f771b1edbe8c7fc89f6e20b824 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Mon, 20 Apr 2015 17:55:00 -0700 Subject: [PATCH] feat(shell/lean): trap 'std::bad_alloc' and print nicer error message See #489 --- src/shell/lean.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shell/lean.cpp b/src/shell/lean.cpp index 14bf0be03..62ebea5d7 100644 --- a/src/shell/lean.cpp +++ b/src/shell/lean.cpp @@ -604,6 +604,9 @@ int main(int argc, char ** argv) { return ok ? 0 : 1; } catch (lean::throwable & ex) { lean::display_error(diagnostic(env, ios), nullptr, ex); + } catch (std::bad_alloc & ex) { + std::cerr << "out of memory" << std::endl; + return 1; } return 1; }