[sysadmin-bin: 100/168] Die in a more friendly way on SAXParseException
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin: 100/168] Die in a more friendly way on SAXParseException
- Date: Thu, 24 May 2012 19:59:51 +0000 (UTC)
commit 716cc5a054bcaea8c9dfdffaeaa34a024cb85ae3
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Fri Apr 24 19:13:47 2009 -0400
Die in a more friendly way on SAXParseException
validate-doap: When we hit a validation problem, don't dump a
raw Python stacktrace.
validate-doap | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/validate-doap b/validate-doap
index 1c3e546..bf05c98 100755
--- a/validate-doap
+++ b/validate-doap
@@ -3,6 +3,7 @@
from cStringIO import StringIO
import os
import sys
+from xml.sax import SAXParseException
script_path = os.path.realpath(os.path.abspath(sys.argv[0]))
script_dir = os.path.dirname(script_path)
@@ -49,7 +50,11 @@ if len(sys.argv) < 2:
modulename = sys.argv[1]
-nodes = semi_rdf.read_rdf(sys.stdin)
+try:
+ nodes = semi_rdf.read_rdf(sys.stdin)
+except SAXParseException, e:
+ die("XML parse error (line %d): %s" % (e.getLineNumber(), e.getMessage()))
+
seen_project = False
for node in nodes:
if node.name != (DOAP, "Project"):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]