Add a default error message on SensorNotFound
This commit is contained in:
parent
0072b5e076
commit
975dbb26c5
1 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue