From 41fbc58001c48cbea3715eddb8a0526b59a24392 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 19 Jan 2006 09:32:08 +0000 Subject: [PATCH] Catch exceptions a little better for yp2 program --- src/yp2_prog.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/yp2_prog.cpp b/src/yp2_prog.cpp index 244f3b0..4109c86 100644 --- a/src/yp2_prog.cpp +++ b/src/yp2_prog.cpp @@ -1,4 +1,4 @@ -/* $Id: yp2_prog.cpp,v 1.1 2006-01-16 11:22:56 adam Exp $ +/* $Id: yp2_prog.cpp,v 1.2 2006-01-19 09:32:08 adam Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -66,19 +66,21 @@ int main(int argc, char **argv) } if (doc) { - yp2::FactoryStatic factory; - yp2::RouterFleXML router(doc, factory); - - yp2::Package pack; - - pack.router(router).move(); - + try { + yp2::FactoryStatic factory; + yp2::RouterFleXML router(doc, factory); + yp2::Package pack; + pack.router(router).move(); + } + catch (std::runtime_error &e) { + std::cout << "std::runtime error: " << e.what() << "\n"; + exit(1); + } xmlFreeDoc(doc); } } catch ( ... ) { std::cerr << "Unknown Exception" << std::endl; - throw; std::exit(1); } std::exit(0); -- 1.7.10.4