Fixed apiType
and broken error handling
#10536
Merged
apiType
and broken error handling
#10536