Wrap IOException when it happens with ApiException

Change-Id: Ie47c8d6cb40a44d0e38ed264b9d14f282a95752a