ALM-426 better error handling of API responses