Adapt toolserver code to wmflabs, robustify some error handling.