<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri, sans-serif" size="2">
<div>Hi</div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
<div>I want to add a simple exception handler to my boost.python application. I want it to print a simple message to the console, indicating the nature of the error.</div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
<div>I have seen:</div>
<div>&nbsp;</div>
<div>try {</div>
<div>&nbsp;&nbsp;&nbsp; &#8230;</div>
<div>} catch ( error_already_set ) {</div>
<div>&nbsp;&nbsp;&nbsp; PyErr_Print();</div>
<div>}</div>
<div>&nbsp;</div>
<div>But is there a better solution using a boost.python method instead of&nbsp; PyErr_Print() ?</div>
<div>&nbsp;</div>
<div>Or, can I do something like the following?</div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
<div>catch ( const error_already_set&amp; e ) {</div>
<div>&nbsp;&nbsp;&nbsp; cout &lt;&lt; e.what();</div>
<div>}</div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
<div>Best regards</div>
<div>&nbsp;</div>
<div>David</div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
<div><font face="Times New Roman, serif">&nbsp;</font></div>
</font>
</body>
</html>