summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-08-24 21:20:59 -0400
committerLex Neva <github.com@lexneva.name>2018-09-01 20:11:01 -0400
commit7bf8c2d871eb012ad2fbbf34433bd6ea0affb9e5 (patch)
tree380e3425dad25396c3bb9c69ea205129b15e3903 /lib
parentff86bff9eda3dfd0a92b195788757253c5750e6d (diff)
helpful error message for empty path "d" attribute (fixes #220)
also internationalizes "error:" string
Diffstat (limited to 'lib')
-rw-r--r--lib/elements/element.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py
index 4edb00c0..bca743c2 100644
--- a/lib/elements/element.py
+++ b/lib/elements/element.py
@@ -197,7 +197,11 @@ class EmbroideryElement(object):
# In a path, each element in the 3-tuple is itself a tuple of (x, y).
# Tuples all the way down. Hasn't anyone heard of using classes?
- return cubicsuperpath.parsePath(self.node.get("d"))
+ d = self.node.get("d", "")
+ if not d:
+ self.fatal(_("Object %(id)s has an empty 'd' attribute. Please delete this object from your document.") % dict(id=self.node.get("id")))
+
+ return cubicsuperpath.parsePath(d)
@cache
def parse_path(self):
@@ -264,5 +268,7 @@ class EmbroideryElement(object):
return patches
def fatal(self, message):
- print >> sys.stderr, "error:", message
+ # L10N used when showing an error message to the user such as "satin column: One or more of the rungs doesn't
+ # intersect both rails."
+ print >> sys.stderr, _("error:"), message
sys.exit(1)