From 1b8f27331e5fc878fd652234eee5440e6b847fea Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Thu, 18 Feb 2016 22:12:46 +0100 Subject: [PATCH] exceptions: Add common ancestor class ParseError --- CHANGELOG.md | 3 +++ ogn/parser/exceptions.py | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f0a13..f58fa2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## Unreleased +- Moved exceptions from `ogn.exceptions` to `ogn.parser.exceptions` + ## 0.2.1 - 2016-02-17 First release via PyPi. - Added CHANGELOG. diff --git a/ogn/parser/exceptions.py b/ogn/parser/exceptions.py index 387069e..e388e88 100644 --- a/ogn/parser/exceptions.py +++ b/ogn/parser/exceptions.py @@ -4,7 +4,11 @@ exception definitions from datetime import datetime -class AprsParseError(Exception): +class ParseError(Exception): + pass + + +class AprsParseError(ParseError): """Parse error while parsing an aprs packet.""" def __init__(self, aprs_string): self.aprs_string = aprs_string @@ -13,7 +17,7 @@ class AprsParseError(Exception): super(AprsParseError, self).__init__(self.message) -class OgnParseError(Exception): +class OgnParseError(ParseError): """Parse error while parsing an ogn message from aprs comment.""" def __init__(self, aprs_comment): self.aprs_comment = aprs_comment @@ -22,7 +26,7 @@ class OgnParseError(Exception): super(OgnParseError, self).__init__(self.message) -class AmbigousTimeError(Exception): +class AmbigousTimeError(ParseError): """Timstamp from the past/future, can't fully reconstruct datetime from timestamp.""" def __init__(self, reference, packet_time): self.reference = reference