get variable from environmen, raise proper exception if it fails