[tools 1/2] testbot/cgi: Improve the error handling API.