Stackoverflow integration in OneTrueError

I’ve created a nifty little javascript library in TypeScript that I use in OneTrueError. It allows our service to search StackOverflow for relevant questions and answers.

Searching StackOverflows API is quite easy as it is pretty much straight forward. The challenge however, was to create something which can identify the correct StackOverflow tags. To do that we analyze the stack trace and the loaded assemblies. We can for instance add tags for different versions of ASP.NET MVC and Entity Framework.

To make the solution responsive we wanted the StackOverflow client to be at the client side only, hence a TypeScript solution. We made it fully asynchronous using a promise style approach (with the help of this typescript implementation).

Sample code:

StackClient.Client.search('Some exception message', identifiedTags).done(response => {
    $('.widget-support-tickets').css('display', '');
    this.questions(response.items.filter(function (item) { return item.is_answered; }));
});

We filter out all questions that do not have an answer (we are searching for solutions, remember?). Leave a comment if you are interested in the full typescript class.

Result