@@ -320,34 +320,29 @@ int handleExceptions(const std::string & programName, std::function<void()> fun)
320320 std::string error = ANSI_RED " error:" ANSI_NORMAL " " ;
321321 try {
322322 try {
323- try {
324- fun ();
325- } catch (...) {
326- /* Subtle: we have to make sure that any `interrupted'
327- condition is discharged before we reach printMsg()
328- below, since otherwise it will throw an (uncaught)
329- exception. */
330- setInterruptThrown ();
331- throw ;
332- }
333- } catch (Exit & e) {
334- return e.status ;
335- } catch (UsageError & e) {
336- logError (e.info ());
337- printError (" Try '%1% --help' for more information." , programName);
338- return 1 ;
339- } catch (BaseError & e) {
340- logError (e.info ());
341- return e.info ().status ;
342- } catch (std::bad_alloc & e) {
343- printError (error + " out of memory" );
344- return 1 ;
345- } catch (std::exception & e) {
346- printError (error + e.what ());
347- return 1 ;
323+ fun ();
324+ } catch (...) {
325+ /* Subtle: we have to make sure that any `interrupted'
326+ condition is discharged before we reach printMsg()
327+ below, since otherwise it will throw an (uncaught)
328+ exception. */
329+ setInterruptThrown ();
330+ throw ;
348331 }
349- } catch (...) {
350- /* In case logger also throws just give up. */
332+ } catch (Exit & e) {
333+ return e.status ;
334+ } catch (UsageError & e) {
335+ logError (e.info ());
336+ printError (" Try '%1% --help' for more information." , programName);
337+ return 1 ;
338+ } catch (BaseError & e) {
339+ logError (e.info ());
340+ return e.info ().status ;
341+ } catch (std::bad_alloc & e) {
342+ printError (error + " out of memory" );
343+ return 1 ;
344+ } catch (std::exception & e) {
345+ printError (error + e.what ());
351346 return 1 ;
352347 }
353348
0 commit comments