kopia lustrzana https://github.com/glidernet/ogn-python
exceptions: Add common ancestor class ParseError
rodzic
2012310ad2
commit
1b8f27331e
|
@ -1,5 +1,8 @@
|
||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
- Moved exceptions from `ogn.exceptions` to `ogn.parser.exceptions`
|
||||||
|
|
||||||
## 0.2.1 - 2016-02-17
|
## 0.2.1 - 2016-02-17
|
||||||
First release via PyPi.
|
First release via PyPi.
|
||||||
- Added CHANGELOG.
|
- Added CHANGELOG.
|
||||||
|
|
|
@ -4,7 +4,11 @@ exception definitions
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
class AprsParseError(Exception):
|
class ParseError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AprsParseError(ParseError):
|
||||||
"""Parse error while parsing an aprs packet."""
|
"""Parse error while parsing an aprs packet."""
|
||||||
def __init__(self, aprs_string):
|
def __init__(self, aprs_string):
|
||||||
self.aprs_string = aprs_string
|
self.aprs_string = aprs_string
|
||||||
|
@ -13,7 +17,7 @@ class AprsParseError(Exception):
|
||||||
super(AprsParseError, self).__init__(self.message)
|
super(AprsParseError, self).__init__(self.message)
|
||||||
|
|
||||||
|
|
||||||
class OgnParseError(Exception):
|
class OgnParseError(ParseError):
|
||||||
"""Parse error while parsing an ogn message from aprs comment."""
|
"""Parse error while parsing an ogn message from aprs comment."""
|
||||||
def __init__(self, aprs_comment):
|
def __init__(self, aprs_comment):
|
||||||
self.aprs_comment = aprs_comment
|
self.aprs_comment = aprs_comment
|
||||||
|
@ -22,7 +26,7 @@ class OgnParseError(Exception):
|
||||||
super(OgnParseError, self).__init__(self.message)
|
super(OgnParseError, self).__init__(self.message)
|
||||||
|
|
||||||
|
|
||||||
class AmbigousTimeError(Exception):
|
class AmbigousTimeError(ParseError):
|
||||||
"""Timstamp from the past/future, can't fully reconstruct datetime from timestamp."""
|
"""Timstamp from the past/future, can't fully reconstruct datetime from timestamp."""
|
||||||
def __init__(self, reference, packet_time):
|
def __init__(self, reference, packet_time):
|
||||||
self.reference = reference
|
self.reference = reference
|
||||||
|
|
Ładowanie…
Reference in New Issue