I've already asked this question up on StackOverflow, but I'll try to 
summarise and amplify given the 3 or so hours since posting.

In my madness I've wrapped the AdWords API in a bit of C# that uses 
ClearScript to expose API types to JScript using code like this:

    JSengine.AddHostType("AdWordsAppConfig", typeof(AdWordsAppConfig));
    JSengine.AddHostType("AdWordsService", typeof(AdWordsService));
    JSengine.AddHostType("AdWordsUser", typeof(AdWordsUser));
    JSengine.AddHostType("ApiError", typeof(ApiError));
    JSengine.AddHostType("BillingAccount", typeof(BillingAccount));
    JSengine.AddHostType("Budget", typeof(Budget));
    JSengine.AddHostType("BudgetBudgetDeliveryMethod", 
typeof(BudgetBudgetDeliveryMethod));
    JSengine.AddHostType("BudgetBudgetStatus", typeof(BudgetBudgetStatus));
    JSengine.AddHostType("BudgetOperation", typeof(BudgetOperation));
    JSengine.AddHostType("BudgetOrder", typeof(BudgetOrder));
    JSengine.AddHostType("BudgetOrderOperation", 
typeof(BudgetOrderOperation));
    JSengine.AddHostType("BudgetOrderPage", typeof(BudgetOrderPage));
    JSengine.AddHostType("BudgetOrderRequest", typeof(BudgetOrderRequest));
    JSengine.AddHostType("BudgetOrderReturnValue", 
typeof(BudgetOrderReturnValue));
    JSengine.AddHostType("BudgetOrderService", typeof(BudgetOrderService));
    JSengine.AddHostType("BudgetPage", typeof(BudgetPage));
    JSengine.AddHostType("BudgetReturnValue", typeof(BudgetReturnValue));
    JSengine.AddHostType("DateRange", typeof(DateRange));
    JSengine.AddHostType("Money", typeof(Money));
    JSengine.AddHostType("Operator", typeof(Operator));
    JSengine.AddHostType("OrderBy", typeof(OrderBy));
    JSengine.AddHostType("Paging", typeof(Paging));
    JSengine.AddHostType("Predicate", typeof(Predicate));
    JSengine.AddHostType("PredicateOperator", typeof(PredicateOperator));
    JSengine.AddHostType("Selector", typeof(Selector));
    JSengine.AddHostType("SortOrder", typeof(SortOrder));
            
So far so good. I've got gets and mutates working. But I have a bit of a 
problem with what happens when an error occurs.

In the JScript script (yeah, Microsoft's server-side JavaScript) I have (in 
part)

    var order = new BudgetOrder();
    order.billingAccountId = acct.id;
    order.startDateTime = "20160830 000000 Australia/Perth";
    order.endDateTime = "20160830 235959 Australia/Perth";
    var amt = new Money();
    amt.microAmount = 10000000;
    order.spendingLimit = amt;

    var boo = new BudgetOrderOperation();
    boo.operator = Operator.ADD;
    boo.operand = order;
    var mutations = ToTypedArray(BudgetOrderOperation, [boo]);

    var response;    
    try {
      response = bos.mutate(mutations);
      Console.WriteLine(response.value[0].billingAccountId);
      Console.WriteLine(response.value[0].id);
      Console.WriteLine(response.value[0].lastRequest.status.ToString());
    } catch (exc) {
      Console.WriteLine(exc.message);
    }

If the mutate fails for whatever reason, in the last case due to an 
INVALID_BUDGET_DATE_RANGE, the catch fires. Fine. However the exc var 
contains very little useful information apart from

    description: "" 
    message: "" 
    name: "Error" 
    number: -2146190593 

Is there a callback or some global data structure I can hook into that will 
let me know what the result of the transaction attempt was? Are there any 
alternatives I should think about?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/0eda4f2f-fc91-4c7e-a9df-19ad764f940a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to