Alternate MBGL_CHECK_ERROR implementation

Doesn't rely on lambdas or throw from a destructor.