Update uses of string exceptions

This commit is contained in:
Andrew M. Kuchling 2008-09-13 01:57:25 +00:00
parent 0bef15846f
commit d9a9c1066c
4 changed files with 7 additions and 9 deletions

View File

@ -21,7 +21,7 @@ def _compute_len(param):
mant, l = math.frexp(float(param))
bitmask = 1L << l
if bitmask <= param:
raise 'FATAL', '(param, l) = %r' % ((param, l),)
raise RuntimeError('(param, l) = %r' % ((param, l),))
while l:
bitmask = bitmask >> 1
if param & bitmask:

View File

@ -80,9 +80,9 @@ class Packer(xdr.Packer):
# Exceptions
BadRPCFormat = 'rpc.BadRPCFormat'
BadRPCVersion = 'rpc.BadRPCVersion'
GarbageArgs = 'rpc.GarbageArgs'
class BadRPCFormat(Exception): pass
class BadRPCVersion(Exception): pass
class GarbageArgs(Exception): pass
class Unpacker(xdr.Unpacker):

View File

@ -8,10 +8,8 @@
import sys
from math import sqrt
error = 'fact.error' # exception
def fact(n):
if n < 1: raise error # fact() argument should be >= 1
if n < 1: raise ValueError # fact() argument should be >= 1
if n == 1: return [] # special case
res = []
# Treat even factors special, so we can use i = i+2 later

View File

@ -93,8 +93,8 @@ class _CoEvent:
self.e.wait()
self.e.clear()
Killed = 'Coroutine.Killed'
EarlyExit = 'Coroutine.EarlyExit'
class Killed(Exception): pass
class EarlyExit(Exception): pass
class Coroutine:
def __init__(self):