ogn-python/ogn/exceptions.py

21 wiersze
704 B
Python
Czysty Zwykły widok Historia

2015-11-15 18:21:19 +00:00
"""
exception definitions
"""
class AprsParseError(Exception):
2015-11-19 22:17:12 +00:00
"""Parse error while parsing an aprs packet."""
def __init__(self, aprs_string):
self.message = "This is not a valid APRS string: %s" % aprs_string
2015-11-15 18:21:19 +00:00
super(AprsParseError, self).__init__(self.message)
2015-11-19 22:17:12 +00:00
self.aprs_string = aprs_string
class OgnParseError(Exception):
"""Parse error while parsing an aprs packet substring"""
def __init__(self, substring, expected_type):
self.message = "For type %s this is not a valid token: %s" % (expected_type, substring)
super(OgnParseError, self).__init__(self.message)
2015-11-15 18:21:19 +00:00
self.substring = substring
self.expected_type = expected_type