xattr-helper: use ValueError when the input is wrong
authorMike Frysinger <vapier@gentoo.org>
Fri, 11 Oct 2013 10:24:22 +0000 (06:24 -0400)
committerMike Frysinger <vapier@gentoo.org>
Fri, 11 Oct 2013 10:24:22 +0000 (06:24 -0400)
This is the standard exception for when the input is incorrect.

bin/xattr-helper.py

index 92bf1a28a198b5bd5be8f92a909902a891ab2b4d..83ee32c810bcc2f6ccf49bc7d3fd0e85d105a99a 100755 (executable)
@@ -135,13 +135,13 @@ def restore_xattrs(file_in):
                        parts = line.split(b'=', 1)
                        if len(parts) == 2:
                                if pathname is None:
-                                       raise AssertionError('line %d: missing pathname' % (i + 1,))
+                                       raise ValueError('line %d: missing pathname' % (i + 1,))
                                attr = unquote(parts[0])
-                               # strip trailing newline and quotes 
+                               # strip trailing newline and quotes
                                value = unquote(parts[1].rstrip(b'\n')[1:-1])
                                xattr.set(pathname, attr, value)
                        elif line.strip():
-                               raise AssertionError("line %d: malformed entry" % (i + 1,))
+                               raise ValueError('line %d: malformed entry' % (i + 1,))
 
 def main(argv):