More robust API error reporting

Single private apiErrorMessage() function handles other failure codes
than 'http'.

Bug: 68474
Change-Id: Id0201c0c9cf8f003d7619f0328a1b4222c3a16a4
Merge "More robust API error reporting"