diff --git a/lib/errors.py b/lib/errors.py
index 181288618d25bea24fd5c08435029bd49ad9ac06..948920c27ab8e495fcd6c4045fc1c1245412e312 100644
--- a/lib/errors.py
+++ b/lib/errors.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -482,4 +482,5 @@ def MaybeRaise(result):
   error = GetEncodedError(result)
   if error:
     (errcls, args) = error
-    raise errcls(args)
+    # pylint: disable=W0142
+    raise errcls(*args)
diff --git a/test/ganeti.errors_unittest.py b/test/ganeti.errors_unittest.py
index ec25912c60da75ed8a74396c14a4d6fbd0f52fc8..f10f661c7ae0b03822da571311d079947a101f07 100755
--- a/test/ganeti.errors_unittest.py
+++ b/test/ganeti.errors_unittest.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 #
 
-# Copyright (C) 2010 Google Inc.
+# Copyright (C) 2010, 2012 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -53,14 +53,25 @@ class TestErrors(testutils.GanetiTestCase):
                            ("GenericError", (True, 100, "foo", ["x", "y"])))
 
   def testMaybeRaise(self):
+    testvals = [None, 1, 2, 3, "Hello World", (1, ), (1, 2, 3),
+                ("NoErrorClassName", []), ("NoErrorClassName", None),
+                ("GenericError", [1, 2, 3], None), ("GenericError", 1)]
     # These shouldn't raise
-    for i in [None, 1, 2, 3, "Hello World", (1, ), (1, 2, 3),
-              ("NoErrorClassName", []), ("NoErrorClassName", None),
-              ("GenericError", [1, 2, 3], None), ("GenericError", 1)]:
+    for i in testvals:
       errors.MaybeRaise(i)
 
     self.assertRaises(errors.GenericError, errors.MaybeRaise,
                       ("GenericError", ["Hello"]))
+    # Check error encoding
+    for i in testvals:
+      src = errors.GenericError(i)
+      try:
+        errors.MaybeRaise(errors.EncodeException(src))
+      except errors.GenericError, dst:
+        self.assertEqual(src.args, dst.args)
+        self.assertEqual(src.__class__, dst.__class__)
+      else:
+        self.fail("Exception %s not raised" % repr(src))
 
   def testGetEncodedError(self):
     self.assertEqualValues(errors.GetEncodedError(["GenericError",