#pragma once #include #include #include namespace mbgl { namespace gl { struct Error : std::runtime_error { using std::runtime_error::runtime_error; }; void checkError(const char *cmd, const char *file, int line); #ifndef NDEBUG #define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { ~__MBGL_C_E() noexcept(false) { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }()) #else #define MBGL_CHECK_ERROR(cmd) (cmd) #endif } // namespace gl } // namespace mbgl