mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-20 00:54:45 +01:00
Better error reporting.
This commit is contained in:
parent
0768ce1c85
commit
8a53eab39d
@ -471,10 +471,10 @@ def safeEval(s, namespace={'True': True, 'False': False, 'None': None}):
|
||||
if node.__class__ is compiler.ast.Module:
|
||||
return node.doc
|
||||
else:
|
||||
raise ValueError, 'Unsafe string.'
|
||||
raise ValueError, 'Unsafe string: %r' % s
|
||||
node = nodes[0]
|
||||
if node.__class__ is not compiler.ast.Discard:
|
||||
raise ValueError, 'Invalid expression: %s'
|
||||
raise ValueError, 'Invalid expression: %r' % s
|
||||
node = node.getChildNodes()[0]
|
||||
def checkNode(node):
|
||||
if node.__class__ is compiler.ast.Const:
|
||||
@ -493,7 +493,7 @@ def safeEval(s, namespace={'True': True, 'False': False, 'None': None}):
|
||||
if checkNode(node):
|
||||
return eval(s, namespace, namespace)
|
||||
else:
|
||||
raise ValueError, 'Unsafe string.'
|
||||
raise ValueError, 'Unsafe string: %r' % s
|
||||
|
||||
def exnToString(e):
|
||||
"""Turns a simple exception instance into a string (better than str(e))"""
|
||||
|
Loading…
Reference in New Issue
Block a user