From 975dbb26c592b04aa43b0bf03ff83ea205902626 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 7 Feb 2013 15:21:22 +0100 Subject: [PATCH] Add a default error message on SensorNotFound --- weboob/applications/wetboobs/wetboobs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/weboob/applications/wetboobs/wetboobs.py b/weboob/applications/wetboobs/wetboobs.py index a4f7ff75..25e1f83f 100644 --- a/weboob/applications/wetboobs/wetboobs.py +++ b/weboob/applications/wetboobs/wetboobs.py @@ -19,10 +19,11 @@ 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.formatters.iformatter import IFormatter, PrettyFormatter +import sys __all__ = ['WetBoobs'] @@ -92,6 +93,13 @@ class WetBoobs(ReplApplication): if len(args) == 2: 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): """ current CITY_ID