0
0
Fork 0

[jsinterp] Better error messages

main
Philipp Hagemeister 2014-03-30 07:15:14 +02:00
parent 2b25cb5d76
commit 77ffa95701
1 changed files with 4 additions and 1 deletions

View File

@ -99,9 +99,12 @@ class JSInterpreter(object):
def extract_function(self, funcname): def extract_function(self, funcname):
func_m = re.search( func_m = re.search(
r'function ' + re.escape(funcname) + (r'(?:function %s|%s\s*=\s*function)' % (
re.escape(funcname), re.escape(funcname))) +
r'\((?P<args>[a-z,]+)\){(?P<code>[^}]+)}', r'\((?P<args>[a-z,]+)\){(?P<code>[^}]+)}',
self.code) self.code)
if func_m is None:
raise ExtractorError('Could not find JS function %r' % funcname)
argnames = func_m.group('args').split(',') argnames = func_m.group('args').split(',')
def resf(args): def resf(args):