<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Dear Rcpp experts,<br>
    <blockquote cite="mid:4D11E67A.4010704@kcl.ac.uk" type="cite"> <br>
      I have got another problem with the throw of exception in C++
      channelled into R. Apologies but these codes are not reproducible:
      I didn't succeed to use the BEGIN_RCPP ... END_RCPP commands with
      the inline-package. Help regarding this would be also welcomed. <br>
      <br>
      #################################################<br>
      SEXP edge_update(SEXP D, SEXP Vpair){<br>
      BEGIN_RCPP<br>
      &nbsp;&nbsp; // Translation.<br>
      &nbsp;&nbsp; NumericMatrix xD(D); <br>
      &nbsp;&nbsp; IntegerVector xVpair(Vpair); <br>
      &nbsp;&nbsp; xVpair = xVpair-1; <br>
      &nbsp;&nbsp; for(int i=0; i&lt;xVpair.size(); i++) if(xVpair[i] &lt; 0)<b>
        throw("Matrix Index is lower than 0."); </b><br>
      &nbsp;&nbsp; cxx_edge_update(xD,xVpair);&nbsp;&nbsp;&nbsp; <br>
      return xD;<br>
      END_RCPP<br>
      }//edge.update<br>
      #################################################<br>
      <br>
      However, when I run it in R, I only get:<br>
      <br>
      &gt; edge.update(D10,c(0,2))<br>
      Error in edge.update(D10, c(0, 2)) : c++ exception (unknown
      reason)<br>
      <br>
      How can I modify my code in order to get the reason for the
      exception printed within R. <br>
      Thank you very much, <br>
      <br>
      <br>
      <div class="moz-signature">-- <br>
        <div class="moz-signature"><font face="Times" size="3"> Cedric
            Ginestet <br>
            Centre for Neuroimaging Sciences (L3.04) <br>
            NIHR Biomedical Research Centre <br>
            Department of Neuroimaging <br>
            Institute of Psychiatry, Box P089 <br>
            King's College London <br>
            De Crespigny Park<br>
            London <br>
            SE5 8AF <br>
            Tel: (+44) 20-3228-3052<br>
            Fax: (+44) 20-3228-2116<br>
            Email: <a moz-do-not-send="true"
              class="moz-txt-link-abbreviated"
              href="mailto:cedric.ginestet@kcl.ac.uk">cedric.ginestet@kcl.ac.uk</a><br>
          </font> </div>
      </div>
    </blockquote>
  </body>
</html>