Handle errors when mocking globals