Rework cancellation behaviors so that the failure block and error are invoked.

* Add new error code for cancelled operations
* Ensure the failure block is called when cancelled