Do not use string exceptions
Fri Jun 25 00:32:55 UTC 2010 Alberto Bertogli <albertito@blitiri.com.ar>
* Do not use string exceptions
String exceptions are deprecated and will soon no longer be supported at all.
Most of the instances of string exceptions in our code were not meant to be
catched, but just to get meaningful backtraces.
This patch replaces them with appropriate, usually generic, exceptions that
serve the same purpose.
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2013-07-18 20:22:19.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-07-18 20:22:19.000000000 +0000
@@ -79,7 +79,7 @@
def filter_file(s):
if '..' in s or '"' in s:
- raise 'FilterFile FAILED'
+ raise Exception, 'FilterFile FAILED'
if s == '/':
return s
@@ -116,7 +116,7 @@
return s.decode(e).encode('utf8', 'replace')
except UnicodeDecodeError:
pass
- raise 'DecodingError', config.repoencoding
+ raise UnicodeDecodeError, config.repoencoding
def escape(s):
@@ -2404,7 +2404,7 @@
break
else:
# not found
- raise "RepoNotFound", name
+ raise Exception, "Repo not found: " + repr(name)
# fill the configuration
base = all_configs.base