Skip to content

Commit

Permalink
changes to getting the errormessage from the API response
Browse files Browse the repository at this point in the history
  • Loading branch information
jannejjj committed Aug 15, 2024
1 parent 769b37d commit a5fd7a8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Salesforce
/// <param name="input">Information to update the sobject.</param>
/// <param name="options">Information about the salesforce destination.</param>
/// <param name="cancellationToken"></param>
/// <returns>Object { JObject Body, bool RequestIsSuccessful, Exception ErrorException, string ErrorMessage, string Token }</returns>
/// <returns>Object { dynamic Body, bool RequestIsSuccessful, Exception ErrorException, string ErrorMessage, string Token }</returns>
public static async Task<Result> ExecuteQuery(
[PropertyTab] Input input,
[PropertyTab] Options options,
Expand Down Expand Up @@ -52,12 +52,12 @@ CancellationToken cancellationToken
try
{
var response = await client.ExecuteAsync(request, cancellationToken);
var content = JsonConvert.DeserializeObject<dynamic>(response.Content);
dynamic content = JsonConvert.DeserializeObject(response.Content);

if (options.AuthenticationMethod is AuthenticationMethod.OAuth2WithPassword && options.ReturnAccessToken)
return new Result(content, response.IsSuccessful, response.ErrorException, response.IsSuccessful ? string.Empty : content[0].message, accessToken);
return new Result(content, response.IsSuccessful, response.ErrorException, response.IsSuccessful ? string.Empty : content[0].Value<string>("message"), accessToken);
else
return new Result(content, response.IsSuccessful, response.ErrorException, response.IsSuccessful ? string.Empty : content[0].message, string.Empty);
return new Result(content, response.IsSuccessful, response.ErrorException, response.IsSuccessful ? string.Empty : content[0].Value<string>("message"), string.Empty);
}
catch (ArgumentException)
{
Expand Down

0 comments on commit a5fd7a8

Please sign in to comment.