This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: problems with error handling
ok, once more the solution to the problem is: rtfm. in order to continue
the program the default error handler
must be switched of:
quote from manual:
_Function:_ gsl_error_handler_t *gsl_set_error_handler_off* /()/
This function turns off the error handler by defining an error
handler which does nothing. This will cause the program to continue
after any error, so the return values from any library routines must
be checked. This is the recommended behavior for production
programs. The previous handler is returned (so that you can restore
it later).
daniel
Daniel Rohe wrote:
> Achim Gaedke wrote:
>
>> Daniel Rohe schrieb:
>>
>>> ...
>>>
>>> but all that happens if the error occurs is
>>>
>>> >gsl: qagp.c:504: ERROR: integral is divergent, or slowly convergent
>>> Abort
>>>
>>> I guess I'm making a silly mistake once more. can anyone give me a
>>> hint?
>>>
>> No, not really. Here is the hint: The default error handling is: (see
>> gsl/err/error.c)
>>
>> void
>> gsl_error (const char * reason, const char * file, int line, int
>> gsl_errno)
>> {
>> if (gsl_error_handler) {
>> (*gsl_error_handler) (reason, file, line, gsl_errno);
>> return ;
>> }
>>
>> gsl_stream_printf ("ERROR", file, line, reason);
>> abort ();
>> }
>>
>> That is the reason. More can be read in gsl-Reference: Chapter Error
>> handling
>>
> I did look at this chapter actually, and I copied the following example:
>
> start quote from gsl-manual:
>
> Here is an example of some code which checks the return value of a
> function where an error might be reported,
>
> int status = gsl_fft_complex_radix2_forward (data, n);
>
> if (status) {
> if (status == GSL_EINVAL) {
> fprintf (stderr, "invalid argument, n=%d\n", n);
> } else {
> fprintf (stderr, "failed, gsl_errno=%d\n",
> status);
> }
> exit (-1);
> }
>
> end quote.
>
> can you think of some solution to the problem?
>
> thanks for the help,
>
> daniel
>