diff options
author | Ying-Chieh Liao <ijliao@FreeBSD.org> | 2003-04-08 04:12:18 +0000 |
---|---|---|
committer | Ying-Chieh Liao <ijliao@FreeBSD.org> | 2003-04-08 04:12:18 +0000 |
commit | 75ffe767758961b3cc10228997630f9209033b83 (patch) | |
tree | 57c2e9e9c3c8e89f50c770ba29a47d9b7349ebc4 /ftp | |
parent | Fix build with mozilla-1.4a. (diff) |
better error handling
Obtained from: author post on mailing list
Notes
Notes:
svn path=/head/; revision=78579
Diffstat (limited to 'ftp')
-rw-r--r-- | ftp/emirror/Makefile | 1 | ||||
-rw-r--r-- | ftp/emirror/files/patch-main.py | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/ftp/emirror/Makefile b/ftp/emirror/Makefile index 41ca473eefa1..57cea36f7141 100644 --- a/ftp/emirror/Makefile +++ b/ftp/emirror/Makefile @@ -8,6 +8,7 @@ PORTNAME= emirror PORTVERSION= 2.1.21 +PORTREVISION= 1 CATEGORIES= ftp python MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \ ftp://eclipt.uni-klu.ac.at/pub/projects/emirror/ diff --git a/ftp/emirror/files/patch-main.py b/ftp/emirror/files/patch-main.py new file mode 100644 index 000000000000..40a0aadb8db4 --- /dev/null +++ b/ftp/emirror/files/patch-main.py @@ -0,0 +1,35 @@ +--- main.py.orig Tue Apr 8 12:09:31 2003 ++++ main.py Tue Apr 8 12:09:55 2003 +@@ -1036,6 +1036,7 @@ + + # Do some error handling + def HandleError(self, error, source, extra = None): ++ """ Perform error handling for given errors. """ + if (str(error) != ""): + if (type(error) == TupleType) or (type(error) == InstanceType): + errornumber = atoi(str(error[0])) +@@ -1044,8 +1045,13 @@ + errornumber = atoi(str(error)[0:3]) + errormessage = strip(str(error)[4:]) + else: +- errornumber = 999 +- errormessage = "emirror internal: unknown error" ++ # If no error is given, use the traceback ++ if (str(sys.exc_info()[0].__name__) == "EOFError"): ++ errornumber = 902 ++ errormessage = "EOFError" ++ else: ++ errornumber = 999 ++ errormessage = format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]) + self.log4py.error("[ %s ] Error: #%d - %s" % (str(self.title), errornumber, errormessage)) + found = FALSE + for i in range(len(errormsgs)): +@@ -1098,7 +1104,7 @@ + self.log4py.error("Please report this error to Martin.Preishuber@eclipt.at") + self.log4py.error("or check error.py and adapt it (it's not really difficult ;-))") + +- self.AppendLog([LMError, str(errornumber) + "-" + errormessage]) ++ self.AppendLog([LMError, str(errornumber) + "-" + str(errormessage)]) + self.WriteLog() + exit(1) + |