When packet type is unsupported, give error message which specifies

the packet type.
This commit is contained in:
Bill Mitchell 2018-02-07 10:59:45 -06:00
parent 94b89a6da4
commit 817ec38925
1 changed files with 21 additions and 1 deletions

View File

@ -138,6 +138,26 @@ def parse(packet):
def _try_toparse_body(packet_type, body, parsed):
result = {}
unsupported_formats = {
'#':'raw weather report',
'$':'raw gps',
'%':'agrelo',
'&':'reserved',
'(':'unused',
')':'item report',
'*':'complete weather report',
'+':'reserved',
'-':'unused',
'.':'reserved',
'<':'station capabilities',
'?':'general query format',
'T':'telemetry report',
'[':'maidenhead locator beacon',
'\\':'unused',
']':'unused',
'^':'unused',
'}':'3rd party traffic'
}
# NOT SUPPORTED FORMATS
#
# # - raw weather report
@ -159,7 +179,7 @@ def _try_toparse_body(packet_type, body, parsed):
# ^ - unused
# } - 3rd party traffic
if packet_type in '#$%)*<?T[}':
raise UnknownFormat("format is not supported")
raise UnknownFormat('format is not supported: {0}'.format(unsupported_formats[packet_type]))
# user defined
elif packet_type == ',':