tschoonj / xraylib

A library for X-ray matter interaction cross sections for X-ray fluorescence applications
https://github.com/tschoonj/xraylib/wiki
Other
120 stars 54 forks source link

Implement proper error handling #82

Closed tschoonj closed 5 years ago

kalvdans commented 5 years ago

Looks good to me! [EDIT 26 october -18] This merge request has grown far bigger than when I reviewed it.

tschoonj commented 5 years ago

Hi @AndreWaehlisch

I have updated the IDL bindings to use the new error handling API. I tested it quickly with IDL 7.1 for Linux but I would be grateful if you and/or your colleagues could give this a try to ensure everything still works...

Thanks in advance!

AndreWaehlisch commented 5 years ago

I am assuming bad input (e.g. Z=0) is supposed to fail silently now. In that case everything works fine for me with IDL8.5.1 (I am on openSuse). The following message becomes a little bit misleading however: GETCOMPOUNDDATANISTBYNAME: Error: check preceding error messages

Thanks for keeping the IDL binding alive :-)

tschoonj commented 5 years ago

Yep that's correct... bad input will no longer produce error messages except some special ones like GETCOMPOUNDDATANISTBYNAME.

You're also correct about the misleading nature of those remaining error messages... Feel free to fix them 😄

tschoonj commented 5 years ago

Looks good to me! [EDIT 26 october -18] This merge request has grown far bigger than when I reviewed it.

Sorry, I only now saw the edit of your previous comment.

This is indeed becoming a big one... I want at the very least that all C API is unittested. I have written some unittests for the bindings, but writing them all would take forever. Those that are SWIG generated and use only fundamental types like double and int are unlikely to give trouble anyway. Those that deal with structs may need some testing though as I wrote the language specific SWIG glue for those myself.

Fortran and Pascal may need proper unittests for all though, as I am managing those bindings myself entirely, partially through python generated code.

Feel free to help out by the way :smile: