From bd775fd4290049572ebbe76f876ea398ec45393d Mon Sep 17 00:00:00 2001 From: IceArmy Date: Wed, 29 Jun 2011 00:47:37 -0700 Subject: [PATCH] Improve error reporting for injectJsInFrame() Also changed warnings to debugs --- python/pyphantomjs/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/pyphantomjs/utils.py b/python/pyphantomjs/utils.py index ad406e86..23f59d14 100644 --- a/python/pyphantomjs/utils.py +++ b/python/pyphantomjs/utils.py @@ -23,7 +23,7 @@ import codecs import argparse from PyQt4.QtCore import QDateTime, Qt, QtDebugMsg, QtWarningMsg, \ - QtCriticalMsg, QtFatalMsg, qWarning + QtCriticalMsg, QtFatalMsg, qDebug from csconverter import CSConverter from plugincontroller import Bunch, do_action @@ -127,17 +127,17 @@ def injectJsInFrame(filePath, libraryPath, targetFrame, startingScript=False): result = coffee2js(script) if result[0] is False: if startingScript: - sys.exit(result[1]) + sys.exit('%s: \'%s\'' % (result[1], filePath)) else: - qWarning(result[1]) + qDebug('%s: \'%s\'' % (result[1], filePath)) script = '' else: script = result[1] targetFrame.evaluateJavaScript(script) return True - except IOError: - qWarning('No such file or directory: \'%s\'' % filePath) + except IOError as (t, e): + qDebug('%s: \'%s\'' % (e, filePath)) return False