From 462b734307c7fecd6b57d6c61adaf81b62f03c74 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sun, 12 May 2013 04:46:30 +0200 Subject: [PATCH] Exit in a well-defined manner upon occurrence of said error. --- automanga | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/automanga b/automanga index 0381786..36bd1cf 100755 --- a/automanga +++ b/automanga @@ -65,10 +65,15 @@ if libname is not None: sys.exit(1) else: libname = "local" - if len(args) > 0: - mng = manga.local.manga(args[0]) - else: - mng = manga.local.manga(".") + try: + if len(args) > 0: + mdir = args[0] + else: + mdir = "." + mng = manga.local.manga(mdir) + except TypeError: + sys.stderr.write("automanga: not a valid manga directory: %s\n" % mdir) + sys.exit(1) mprof = None if profile is None else profile.getmanga(libname, mng.id, True) if profile is not None: -- 2.11.0