From: Axel R. <ro...@us...> - 2014-08-26 14:38:27
|
Update of /cvsroot/sdif/Easdif/swig/python In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15384/swig/python Modified Files: easdif-python.i Log Message: Added special exception specification for OpenRead to be able to catch the SDIFBadHeader exception. Index: easdif-python.i =================================================================== RCS file: /cvsroot/sdif/Easdif/swig/python/easdif-python.i,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** easdif-python.i 19 Jun 2014 20:48:52 -0000 1.18 --- easdif-python.i 26 Aug 2014 14:38:24 -0000 1.19 *************** *** 6,9 **** --- 6,12 ---- // // $Log$ + // Revision 1.19 2014/08/26 14:38:24 roebel + // Added special exception specification for OpenRead to be able to catch the SDIFBadHeader exception. + // // Revision 1.18 2014/06/19 20:48:52 roebel // Properly handle exception in OpenRead. *************** *** 82,85 **** --- 85,108 ---- %include ../easdif-defines.i + %exception OpenRead { + try { + $action + } catch(const SDIFBadHeader& e) { + PyErr_SetString(PyExc_EOFError,e.getmessage().c_str()); + return 0; + } catch(const SDIFEof& e) { + PyErr_SetString(PyExc_EOFError,e.getmessage().c_str()); + return 0; + } catch(const SDIFException& e) { + PyErr_SetString(PyExc_IOError,e.getmessage().c_str()); + return 0; + } catch(const std::exception& e) { + PyErr_SetString(PyExc_IOError, e.what()); + return 0; + } catch(...) { + SWIG_exception(SWIG_UnknownError,"Unknown exception"); + } + } + %exception ReadNextFrame { try { |