Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of a GoogleAdsException for test purpose do not work anymore with v12 #402

Closed
cbeauchemin opened this issue May 13, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@cbeauchemin
Copy link

I was using the following line to create a fake exception for my mock:

var exception = GoogleAdsException.Create(new RpcException(Status.DefaultCancelled));

It do not work anymore.

trailer object inside the lib is empty. Its searching for the key
google.ads.googleads.v9.errors.googleadsfailure-bin

Object Lib\AdsBaseException.cs, line 98

@cbeauchemin cbeauchemin added the bug Something isn't working label May 13, 2022
@danny-quinn
Copy link

I too use this method in tests to mock failures and have run into this bug when using 12.0.0

I have reverted to version 11.0.1 for the time being.

// Works in 11.0.1 not 12.0.0
var g = GoogleAdsException.Create(
new RpcException(
new Status(StatusCode.PermissionDenied,"Error Detail")
)
);

@cbeauchemin
Copy link
Author

@danny-quinn i've found an alternative which is less pretty but work until its fixed

private GoogleAdsException GetFakeGoogleAdsException()
{
var metadata = new Metadata();
metadata.Add("google.ads.googleads.v9.errors.googleadsfailure-bin", new byte[0]);
var rcpException = new RpcException(Status.DefaultCancelled, metadata, "Some message");
return (GoogleAdsException)GoogleAdsException.Create(rcpException);
}

@AnashOommen
Copy link
Member

Sorry about that, PR is out for review.

@AnashOommen
Copy link
Member

Fixed in 12.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants