Add a default error message on SensorNotFound

This commit is contained in:
Florent 2013-02-07 15:21:22 +01:00
commit 975dbb26c5

View file

@ -19,10 +19,11 @@
from weboob.capabilities.weather import ICapWeather from weboob.capabilities.weather import ICapWeather
from weboob.capabilities.gauge import ICapGauge from weboob.capabilities.gauge import ICapGauge, SensorNotFound
from weboob.tools.application.repl import ReplApplication from weboob.tools.application.repl import ReplApplication
from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter
import sys
__all__ = ['WetBoobs'] __all__ = ['WetBoobs']
@ -92,6 +93,13 @@ class WetBoobs(ReplApplication):
if len(args) == 2: if len(args) == 2:
return self._complete_object() return self._complete_object()
def bcall_error_handler(self, backend, error, backtrace):
if isinstance(error, SensorNotFound):
msg = unicode(error) or 'Sensor not found (hint: try sensors command)'
print >>sys.stderr, 'Error(%s): %s' % (backend.name, msg)
else:
return ReplApplication.bcall_error_handler(self, backend, error, backtrace)
def do_current(self, line): def do_current(self, line):
""" """
current CITY_ID current CITY_ID