Tags: equinor/cwrap
Tags
Convert ArgumentError to TypeError when calling C function ArgumentError belongs to ctypes, and the fact that we are using ctype is just an implementation details. In order to catch that exception, ctypes has to be imported as well, so that implementation detail might spread through the code base. By converting it to a TypeError, ctypes stays confined inside cwrap, which also makes it easier for user to drop methods based on a C implementation for a pure python implmentation The error message in the exception now looks like this `Argument 4: cannot create a <class 'ctypes.c_double'> from the given value [1, 2, 3] (<type 'list'>)` It still mentions ctypes, and it is not trivial to get rid of it while maintinaing the message as informative as it is now. The content of the message is arguably not part of the API so I decided to not investigate this further
PreviousNext