diff --git a/camel/camel-imapx-command.c b/camel/camel-imapx-command.c
index de1de70..e1ebf00 100644
--- a/camel/camel-imapx-command.c
+++ b/camel/camel-imapx-command.c
@@ -581,6 +581,8 @@ gboolean
 camel_imapx_command_set_error_if_failed (CamelIMAPXCommand *ic,
                                          GError **error)
 {
+	CamelIMAPXJob *job;
+
 	g_return_val_if_fail (CAMEL_IS_IMAPX_COMMAND (ic), FALSE);
 
 	if (ic->status != NULL && ic->status->result != IMAPX_OK) {
@@ -595,6 +597,10 @@ camel_imapx_command_set_error_if_failed (CamelIMAPXCommand *ic,
 		return TRUE;
 	}
 
+	job = camel_imapx_command_get_job (ic);
+	if (job && g_cancellable_set_error_if_cancelled (camel_imapx_job_get_cancellable (job), error))
+		return TRUE;
+
 	return FALSE;
 }
 
diff --git a/camel/camel-imapx-job.c b/camel/camel-imapx-job.c
index 244afcd..a91e0ae 100644
--- a/camel/camel-imapx-job.c
+++ b/camel/camel-imapx-job.c
@@ -337,3 +337,14 @@ camel_imapx_job_set_folder (CamelIMAPXJob *job,
 	g_mutex_unlock (&real_job->folder_lock);
 }
 
+GCancellable *
+camel_imapx_job_get_cancellable (CamelIMAPXJob *job)
+{
+	CamelIMAPXRealJob *real_job;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_JOB (job), NULL);
+
+	real_job = (CamelIMAPXRealJob *) job;
+
+	return real_job->cancellable;
+}
diff --git a/camel/camel-imapx-job.h b/camel/camel-imapx-job.h
index 9b12fdb..a6fbec8 100644
--- a/camel/camel-imapx-job.h
+++ b/camel/camel-imapx-job.h
@@ -80,6 +80,7 @@ gboolean	camel_imapx_job_has_folder	(CamelIMAPXJob *job,
 CamelFolder *	camel_imapx_job_ref_folder	(CamelIMAPXJob *job);
 void		camel_imapx_job_set_folder	(CamelIMAPXJob *job,
 						 CamelFolder *folder);
+GCancellable *	camel_imapx_job_get_cancellable	(CamelIMAPXJob *job);
 
 G_END_DECLS
 
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 33d5618..099f689 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -6683,7 +6682,7 @@ cancel_all_jobs (CamelIMAPXServer *is,
 		/* Send a NULL GError since we already cancelled
 		 * the job and we're not interested in individual
 		 * command errors. */
-		ic->complete (is, ic, NULL, NULL);
+		ic->complete (is, ic, camel_imapx_job_get_cancellable (job), NULL);
 	}
 
 	camel_imapx_command_queue_free (queue);
