fix error catching on fetching doc file in rails 4