2.3 Exception handling

GSL provides a selectable error handler, that is called for occuring errors (like domain errors, division by zero, etc. ). This is switched off. Instead each wrapper function will check the error return value and in case of error an python exception is created.

Here is a python level example:

import pygsl.histogram
import pygsl.errors
hist=pygsl.histogram.histogram2d(100,100)
try:
   hist[-1,-1]=0
except pygsl.errors.gsl_Error,err:
   print err
Will result
input domain error: index i lies outside valid range of 0 .. nx - 1

An exception are ufuncs in the testings.sf module (see section12.2).



Subsections