wrap GL context query in try/catch