<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 18, 2014 at 6:59 PM, Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":2g4" class="" style="overflow:hidden">The key feature of G_fatal_error() isn't printing error messages. The<br>


key feature is that it doesn't return.</div></blockquote></div><br>This is one of the problems of G_fatal_error(), it does not gives good error messages to the user. User gets "<span style="font-family:arial,sans-serif;font-size:13px">G_malloc: unable to allocate %lu bytes of memory at %s:%d</span>" but does not have any idea when and why this happened and what to do about it. If the module calling G_malloc() had the chance to report error by itself, it could suggest to user to change some parameter or use a smaller map. With G_fatal_error() user has only the possibility to try to guess from debug messages, ask on mailing list or keep trying with random changes in input parameters. I don't believe that this is efficient.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">G_fatal_error() is too low level not only for messages but in general, for Python libraries wrapping GRASS library, it does not allow to throw an exception in case of an error. And the same applies for C++ wrappers.<br>

</div><div class="gmail_extra"><br></div><div class="gmail_extra">As far as I understand, the RPC wrapper suggested earlier by <font face="arial, sans-serif">Soeren, would hopefully allow to have exceptions (and no exit()) in Python and C++ and thus potentially higher level error messages and also general error handling would be possible (for those not using the original library).</font></div>

</div>