Pass error code to cancel function (bug 1050544)