Skip to content

Commit

Permalink
attempt to better handle incorrect server output
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1l committed Mar 20, 2017
1 parent 8c6d60d commit 58b1179
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions signalk_client/datum.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

"""dealing with individual data"""

import logging
import math
import re

Expand Down Expand Up @@ -88,8 +89,11 @@ def display_value(self, convert_units=None):
if convert_units != None:
for from_unit, to_unit in convert_units:
if units == from_unit:
value = convert(value, from_unit, to_unit)
units = to_unit
try:
value = convert(value, from_unit, to_unit)
units = to_unit
except TypeError:
logging.warn("Conversion ({} to {}) for {} ({}) failed".format(from_unit, to_unit, self.path, self.value))
out_string = ""
if value == None:
out_string += "--"
Expand Down

0 comments on commit 58b1179

Please sign in to comment.