InvokeAPI Error Logic for C# and JS SDKs

Populates the erorr message when a custom API to returns text and not json in the response content with a non success status code