pavanky · GitHub

The way to deal with this would be to have a macro something along the lines of AF_ERROR. Instead of throwing an exception, this just sets the error string and returns the error.

Here are the culprits

 $ grep -ri throw src/api/cpp/ | grep -v AF_THROW
src/api/cpp/error.hpp:        throw af::exception(__FILE__, __LINE__, __err); \
src/api/cpp/error.hpp:        throw af::exception(__msg, __FILE__, __LINE__, __err);  \
src/api/cpp/error.hpp:#define THROW(__err) throw af::exception(__FILE__, __LINE__, __err)
src/api/cpp/exampleFunction.cpp:                            // is going to return and throw corresponding
src/api/cpp/array.cpp:        if (dim > 3) THROW(AF_ERR_SIZE);
src/api/cpp/array.cpp:        // THOU SHALL NOT THROW IN DESTRUCTORS
src/api/cpp/array.cpp:                default: THROW(AF_ERR_SIZE);
 $ grep -r "return AF_" src/ | grep -v AF_SUCCESS
src/backend/cpu/platform.cpp:    return AF_BACKEND_CPU;
src/backend/cuda/platform.cpp:    return AF_BACKEND_CUDA;
src/backend/opencl/platform.cpp:    return AF_BACKEND_OPENCL;
src/api/unified/symbol_manager.cpp:            return AF_ERR_LOAD_LIB;
src/api/unified/symbol_manager.cpp:        return AF_ERR_LOAD_LIB;
src/api/unified/symbol_manager.hpp:                return AF_ERR_LOAD_LIB;
src/api/unified/symbol_manager.hpp:                return AF_ERR_LOAD_SYM;
src/api/unified/symbol_manager.hpp:        return AF_ERR_ARR_BKND_MISMATCH;                                                    \
src/api/c/colorspace.cpp:    return AF_ERR_NOT_SUPPORTED;
src/api/c/colorspace.cpp:        default: return AF_ERR_ARG;
src/api/c/colorspace.cpp:        default: return AF_ERR_ARG;
src/api/c/plot.cpp:    return AF_ERR_NO_GFX;
src/api/c/plot.cpp:    return AF_ERR_NO_GFX;
src/api/c/version.cpp:    return AF_REVISION;
src/api/c/plot3.cpp:    return AF_ERR_NO_GFX;
src/api/c/plot3.cpp:    return AF_ERR_NO_GFX;
src/api/c/hist.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/image.cpp:    return AF_ERR_NO_GFX;
src/api/c/surface.cpp:    return AF_ERR_NO_GFX;
src/api/c/imageio.cpp:    return AF_ERR_NOT_CONFIGURED;
src/api/c/imageio.cpp:    return AF_ERR_NOT_CONFIGURED;
src/api/c/imageio.cpp:    return AF_ERR_NOT_CONFIGURED;
src/api/c/imageio.cpp:    return AF_ERR_NOT_CONFIGURED;
src/api/c/imageio.cpp:    return AF_ERR_NOT_CONFIGURED;
src/api/c/imageio2.cpp:    return AF_ERR_NOT_CONFIGURED;
src/api/c/imageio2.cpp:    return AF_ERR_NOT_CONFIGURED;

Read the original on github.com ↗