diff --git a/tests/virtual-image.py b/tests/virtual-image.py
index 1fcb30a..c30fad5 100755
--- a/tests/virtual-image.py
+++ b/tests/virtual-image.py
@@ -99,13 +99,13 @@ class VirtualImage(unittest.TestCase):
 
     def send_retry(self, retry_error=1, iterate=True):
         # The default (1) is too-short
-        self.sendall(struct.pack('ii', -1, retry_error))
+        self.con.sendall(struct.pack('ii', -1, retry_error))
         while iterate and ctx.pending():
             ctx.iteration(False)
 
     def send_error(self, device_error=0, iterate=True):
         # The default (0) is a generic error
-        self.sendall(struct.pack('ii', -1, retry_error))
+        self.con.sendall(struct.pack('ii', -2, device_error))
         while iterate and ctx.pending():
             ctx.iteration(False)
 
@@ -212,9 +212,10 @@ class VirtualImage(unittest.TestCase):
         done = False
 
         def verify_cb(dev, res):
-            match, fp = dev.verify_finish(res)
-            self._verify_match = match
-            self._verify_fp = fp
+            try:
+                self._verify_match, self._verify_fp = dev.verify_finish(res)
+            except gi.repository.GLib.Error as e:
+                self._verify_error = e
 
         fp_whorl = self.enroll_print('whorl')
 
@@ -234,20 +235,39 @@ class VirtualImage(unittest.TestCase):
             ctx.iteration(True)
         assert(not self._verify_match)
 
+        # Test verify error cases
+        self._verify_fp = None
+        self._verify_error = None
+        self.dev.verify(fp_whorl, callback=verify_cb)
+        self.send_retry()
+        while self._verify_fp is None and self._verify_error is None:
+            ctx.iteration(True)
+        assert(self._verify_error is not None)
+        assert(self._verify_error.matches(FPrint.device_retry_quark(), FPrint.DeviceRetry.TOO_SHORT))
+
+        self._verify_fp = None
+        self._verify_error = None
+        self.dev.verify(fp_whorl, callback=verify_cb)
+        self.send_error()
+        while self._verify_fp is None and self._verify_error is None:
+            ctx.iteration(True)
+        assert(self._verify_error is not None)
+        print(self._verify_error)
+        assert(self._verify_error.matches(FPrint.device_error_quark(), FPrint.DeviceError.GENERAL))
+
     def test_identify(self):
         done = False
 
-        def verify_cb(dev, res):
-            r, fp = dev.verify_finish(res)
-            self._verify_match = r
-            self._verify_fp = fp
-
         fp_whorl = self.enroll_print('whorl')
         fp_tented_arch = self.enroll_print('tented_arch')
 
         def identify_cb(dev, res):
             print('Identify finished')
-            self._identify_match, self._identify_fp = self.dev.identify_finish(res)
+            try:
+                self._identify_match, self._identify_fp = self.dev.identify_finish(res)
+            except gi.repository.GLib.Error as e:
+                print(e)
+                self._identify_error = e
 
         self._identify_fp = None
         self.dev.identify([fp_whorl, fp_tented_arch], callback=identify_cb)
@@ -263,6 +283,25 @@ class VirtualImage(unittest.TestCase):
             ctx.iteration(True)
         assert(self._identify_match is fp_whorl)
 
+        # Test error cases
+        self._identify_fp = None
+        self._identify_error = None
+        self.dev.identify([fp_whorl, fp_tented_arch], callback=identify_cb)
+        self.send_retry()
+        while self._identify_fp is None and self._identify_error is None:
+            ctx.iteration(True)
+        assert(self._identify_error is not None)
+        assert(self._identify_error.matches(FPrint.device_retry_quark(), FPrint.DeviceRetry.TOO_SHORT))
+
+        self._identify_fp = None
+        self._identify_error = None
+        self.dev.identify([fp_whorl, fp_tented_arch], callback=identify_cb)
+        self.send_error()
+        while self._identify_fp is None and self._identify_error is None:
+            ctx.iteration(True)
+        assert(self._identify_error is not None)
+        assert(self._identify_error.matches(FPrint.device_error_quark(), FPrint.DeviceError.GENERAL))
+
     def test_verify_serialized(self):
         done = False