diff --git a/bcos-sdk/SWIG/BCOS.i b/bcos-sdk/SWIG/BCOS.i index 0410694f70..5bb2881504 100644 --- a/bcos-sdk/SWIG/BCOS.i +++ b/bcos-sdk/SWIG/BCOS.i @@ -1,4 +1,15 @@ %module(directors="1") bcos + +%include exception.i +%exception { + try { + $action + } catch(std::exception &e) { + auto str = boost::diagnostic_information(e); + SWIG_exception(SWIG_RuntimeError, str.c_str()); + } +} + %include "Utilities.i" %include "Crypto.i" %include "Transaction.i"