Raise a proper excepetion when getting the resource fails