I have written this code to force a PartialFailureError to try and parse 
the PartialFailureError to handle my errors correctly but I'm having 
trouble actually parsing the error. Here is the code below

            var invalidAsset = new Asset
            {
                Name = "My Test Asset",
                Type = AssetType.Image,
                TextAsset = new TextAsset
                {
                    Text = new string('B', 500000)
                }
            };

            var invalidAsset2 = new Asset
            {
                Name = "Invalid Video Asset",
                Type = AssetType.YoutubeVideo,
                YoutubeVideoAsset = new YoutubeVideoAsset
                {
                    YoutubeVideoId = "invalid_video_id"
                }
            };

            var invalidAsset3 = new Asset
            {
                Name = "My Test Asset",
                Type = AssetType.Image,
                TextAsset = new TextAsset
                {
                    Text = new string('B', 500000)
                }
            };


            var validAsset = new Asset
            {
                Name = "My Test Asset",
                Type = AssetType.Text,
                TextAsset = new TextAsset
                {
                    Text = "This is a valid asset."
                }
            };

            var operations = new AssetOperation[]
            {
                    new AssetOperation { Create = validAsset },
                    new AssetOperation { Create = invalidAsset },
                    new AssetOperation { Create = invalidAsset2 },
                    new AssetOperation { Create = invalidAsset3 }
            };
            GAS.MutateAssetsResponse response;

            var request = new MutateAssetsRequest
            {
                CustomerId = CustomerId.ToString(),
                PartialFailure = true,
                Operations = { operations }
            };

            try
            {
                response = service.MutateAssets(request);
                testOutputHelper.WriteLine("Asset Resource Name: " + 
response.Results[0].ResourceName);
            }
            catch (GoogleAdsException ex)
            {
                testOutputHelper.WriteLine($"Error: {ex.Message}");
                testOutputHelper.WriteLine($"Failure: {ex.Failure}");
            }

and what I get back for the response back for 
response.PartialFailureError.Details[0] is

[0] { "@type": 
"type.googleapis.com/google.ads.googleads.v17.errors.GoogleAdsFailure", 
"@value": 
"CurCHgoDsAMDEglUb28gbG9uZy4apMIeKqDCHkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQk…
 

Shouldn't value be some valid json instead of this string? I tried base64 
decoding it and I got "Too long.  * BBBBBBBBB..." which only corresponds to 
the first error that I got and instead of all the errors as I had multiple 
invalid assets. So my question is what format is this value string exactly 
in so I can decode it and parse the errors from there and also should there 
be more than one error coming back? I know there should be more than one 
error when decoding because this is the PartialFailureError.Message that I 
get back "Multiple errors in ‘details’. First error: Too long., at 
operations[1].create.text_asset.text". 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/adwords-api/b8ec2935-d945-4b2d-8720-5aafcd1e209an%40googlegroups.com.
  • We... Ray
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to