Weird format of PartialFailureError.Details[0]. Shouldn't it be JSON instead of a string

21 views
Skip to first unread message

Ray

unread,
Feb 17, 2025, 7:21:34 PM2/17/25
to Google Ads API and AdWords API Forum
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".

Google Ads API Forum Advisor

unread,
Feb 18, 2025, 1:49:03 AM2/18/25
to raymo...@drivetime.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

From the provided information, I understand you are encountering the TOO_LONG error. This error generally exists when a name is too long for an entity. In order to assist the issue further, provide us with the complete API logs (request and response with request-id and request header) generated at your end so that we can better assist you.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.


Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-02-18 06:48:20Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vH2K7:ref" (ADR-00288636)


 


Reply all
Reply to author
Forward
0 new messages