diff --git a/zeroconf/__init__.py b/zeroconf/__init__.py index 46251828..90439eab 100644 --- a/zeroconf/__init__.py +++ b/zeroconf/__init__.py @@ -91,6 +91,16 @@ _TYPE_TXT, _UNREGISTER_TIME, ) +from .exceptions import ( + AbstractMethodException, + BadTypeInNameException, + Error, + IncomingDecodeError, + NamePartTooLongException, + NonUniqueNameException, + ServiceNameAlreadyRegistered, +) + __author__ = 'Paul Scott-Murphy, William McBrine' __maintainer__ = 'Jakub Stasiak ' @@ -306,37 +316,6 @@ def instance_name_from_service_info(info: "ServiceInfo") -> str: return info.name[: -len(service_name) - 1] -# Exceptions - - -class Error(Exception): - pass - - -class IncomingDecodeError(Error): - pass - - -class NonUniqueNameException(Error): - pass - - -class NamePartTooLongException(Error): - pass - - -class AbstractMethodException(Error): - pass - - -class BadTypeInNameException(Error): - pass - - -class ServiceNameAlreadyRegistered(Error): - pass - - # implementation classes diff --git a/zeroconf/exceptions.py b/zeroconf/exceptions.py new file mode 100644 index 00000000..ea468659 --- /dev/null +++ b/zeroconf/exceptions.py @@ -0,0 +1,51 @@ +""" Multicast DNS Service Discovery for Python, v0.14-wmcbrine + Copyright 2003 Paul Scott-Murphy, 2014 William McBrine + + This module provides a framework for the use of DNS Service Discovery + using IP multicast. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + USA +""" + +# Exceptions + + +class Error(Exception): + pass + + +class IncomingDecodeError(Error): + pass + + +class NonUniqueNameException(Error): + pass + + +class NamePartTooLongException(Error): + pass + + +class AbstractMethodException(Error): + pass + + +class BadTypeInNameException(Error): + pass + + +class ServiceNameAlreadyRegistered(Error): + pass