TwitterExceptionTracker

Mar 6, 2014 at 3:05 PM
Hi,

I'm trying to implement some robust error handling in my application, and reading through the old docs - https://onedrive.live.com/view.aspx?resid=A575E231BFCAB42D!44520&app=OneNote&wdo=2&authkey=!AHR55vnsqTkUK6s

.. I've added the Tools project back into the TweetInvi dev solution and trying to get it to compile. It all goes well until the TwitterExceptionTracker, this specific method:
 public virtual TwitterException ActionFailed(object action, WebException wex)
        {
            var twitterException = new TwitterException(wex);
           TwitterExceptions.Add(new Tuple<object, TwitterException>(action, twitterException));
            
            return twitterException;
        }
The problem is that TwitterException has a constructor of (IWebExceptionInfoExtractor, WebException, string) but it is only being passed the WebException wex.

Any suggestions or thoughts on what I can do? I was aiming at wrapping everything in code as suggested in the documentation using the ITwitterContext..
ITwitterContext context = new TwitterContext();

List<IUser> followers;
if (!context.TryInvokeAction(() => u.Followers, out followers)
{
    // handle error
}
Thanks in advance,
James
Mar 6, 2014 at 8:24 PM
Hi James,

Would you please let me know if you have already implement a big part of your project or not.
The reason I am asking is the latest release provide a new solution to manage exceptions.

Either case, I am not really understanding what is your current issue, would you please give more details.

Sincerely,
Linvi
Mar 7, 2014 at 9:39 AM
Hi Linvi,

I am currently using the latest development branch, but can change what is already implemented if required.

The latest example uses ExceptionHandler.GetLastException(), I was looking for something similar to TwitterContext where I could wrap sections of code in something like a try - catch block.

On a closer look the ExceptionHandler class will do just fine, so please disregard my original post!

Thanks,
James
Marked as answer by linvi on 3/7/2014 at 4:58 AM