From 94fdc674aa940f323665d9c954de580beb016ada Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Wed, 29 Aug 2012 19:32:14 +0200 Subject: [PATCH] Added 'parachute' std::exception handling to python interface --- pcbnew/scripting/pcbnew.i | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pcbnew/scripting/pcbnew.i b/pcbnew/scripting/pcbnew.i index 393df32a8f..efcb39d746 100644 --- a/pcbnew/scripting/pcbnew.i +++ b/pcbnew/scripting/pcbnew.i @@ -52,8 +52,15 @@ { char ExceptionError[256]; sprintf(ExceptionError, "%s\n", TO_UTF8(e.errorText) ); - PyErr_SetString(PyExc_IOError,ExceptionError); - return NULL; + PyErr_SetString(PyExc_IOError,ExceptionError); + return NULL; + } + catch( std::exception &e ) + { + char ExceptionError[256]; + sprintf( ExceptionError, "%s\n", e.what() ); + PyErr_SetString(PyExc_IOError,ExceptionError); + return NULL; } catch( ... ) { @@ -136,4 +143,4 @@ %include "plugins.i" %include "units.i" - \ No newline at end of file +