This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problems with error handling


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]