To chime in about Romain&#39;s comment about recognizing more types.  I would love a more robust exception handling.  I think I already mentioned that but sometimes throwing a std::exception can be very expensive.  something a little bit more robust would be very helpful.   For example, with the discussion that we had a while back about catching the interrupt signal, I had to use an exception that did not inherit std::exception since it took sometimes  over a minute to catch the interrupt.<div>
<br></div><div>-Andrew<br><br><div class="gmail_quote">On Wed, Dec 22, 2010 at 5:25 AM, Dirk Eddelbuettel <span dir="ltr">&lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
On 22 December 2010 at 11:56, Cedric Ginestet wrote:<br>
[...]<br>
<div class="im">|     throw(&quot;Matrix Index is lower than 0.&quot;);<br>
</div>[...]<br>
<div class="im">|     How can I modify my code in order to get the reason for the exception<br>
|     printed within R.<br>
<br>
</div>By passing a exception class that inherits from std::exception, see a C++<br>
reference and / or the examples:<br>
<br>
edd@max:~/svn/rcpp/pkg/Rcpp/inst/examples$ grep throw RcppInline/UncaughtExceptions.r<br>
        &#39;throw std::range_error(&quot;boom&quot;); return R_NilValue ; &#39;,<br>
<br>
Basically, don&#39;t just pass a string, pass a string _used as a ctor_ to the<br>
exception you want to throw, e.g.<br>
<br>
     throw( std::runtime_error(&quot;Matrix Index is lower than 0.&quot;) );<br>
<br>
Hth, Dirk<br>
<font color="#888888"><br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</div></div></blockquote></div><br></div>