Returns whether an error should be displayed as a cancellation.
typedef TaskCancelPredicate = bool Function(Object error);