Use RepoApiError in API-based formatting

Change-Id: I39f759b714e700edfff813252769cdcff38603f8