mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-06-18 13:29:39 +00:00
Refs #8: added better error message when attempting to load unknown template
This commit is contained in:
parent
4185ca5617
commit
55b368414e
|
@ -326,7 +326,7 @@ def get_template_data(template):
|
||||||
with open(path, "rb") as fh:
|
with open(path, "rb") as fh:
|
||||||
data = fh.read()
|
data = fh.read()
|
||||||
except:
|
except:
|
||||||
raise InvalidDiskImage("Template disk image %s not found" % template)
|
raise InvalidDiskImage("Unknown template disk image %s" % template)
|
||||||
try:
|
try:
|
||||||
with open(path + ".inf", "r") as fh:
|
with open(path + ".inf", "r") as fh:
|
||||||
s = fh.read()
|
s = fh.read()
|
||||||
|
@ -339,7 +339,12 @@ def get_template_data(template):
|
||||||
def create_image(template, name):
|
def create_image(template, name):
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
data, inf = get_template_data(template)
|
try:
|
||||||
|
data, inf = get_template_data(template)
|
||||||
|
except InvalidDiskImage, e:
|
||||||
|
info = get_template_info()
|
||||||
|
print("Error: %s\n\n%s" % (e, info))
|
||||||
|
return
|
||||||
print("using %s template:\n %s" % (template, "\n ".join(textwrap.wrap(inf["description"], 77))))
|
print("using %s template:\n %s" % (template, "\n ".join(textwrap.wrap(inf["description"], 77))))
|
||||||
if not options.dry_run:
|
if not options.dry_run:
|
||||||
if os.path.exists(name) and not options.force:
|
if os.path.exists(name) and not options.force:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user