The following example shows how to define a custom error handler function.

%-----------------------------------------------------------------
% custom error handler
%-----------------------------------------------------------------
function myhandler(msg)
    disp('The calceph calls the function myhandler');
    disp('The error message is :')
    disp('----------------------')
    disp(msg)
    disp('----------------------')
    disp('The error handler returns')
end

% set the  error handler to use my own callback
calceph_seterrorhandler(3, 'myhandler')

% open the ephemeris file
peph = CalcephBin.open('example1.dat')