Pass errorCode to cancel function (bug 1050544)

r? @kumar303