From 264d19b8b30b990daf92f43c5bbe3abd5117ba32 Mon Sep 17 00:00:00 2001 From: Bill Mitchell Date: Fri, 9 Feb 2018 19:59:38 -0600 Subject: [PATCH] Test for unsupported formats after testing for supported formats. --- aprslib/parsing/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/aprslib/parsing/__init__.py b/aprslib/parsing/__init__.py index c2eae9a..56e0714 100644 --- a/aprslib/parsing/__init__.py +++ b/aprslib/parsing/__init__.py @@ -158,11 +158,8 @@ def parse(packet): def _try_toparse_body(packet_type, body, parsed): result = {} - if packet_type in unsupported_formats: - raise UnknownFormat('format is not supported: {0}'.format(unsupported_formats[packet_type])) - # user defined - elif packet_type == ',': + if packet_type == ',': logger.debug("Packet is invalid format") body, result = parse_invalid(body) @@ -203,6 +200,11 @@ def _try_toparse_body(packet_type, body, parsed): body, result = parse_position(packet_type, body) + # other data types + elif packet_type in unsupported_formats: + raise UnknownFormat('format is not supported: {0}'.format(unsupported_formats[packet_type])) + + # we are done parsed.update(result)