Skip to content

Commit 5100506

Browse files
authored
Move exceptions into zeroconf.exceptions (#532)
1 parent 89d4755 commit 5100506

2 files changed

Lines changed: 61 additions & 31 deletions

File tree

zeroconf/__init__.py

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@
9191
_TYPE_TXT,
9292
_UNREGISTER_TIME,
9393
)
94+
from .exceptions import (
95+
AbstractMethodException,
96+
BadTypeInNameException,
97+
Error,
98+
IncomingDecodeError,
99+
NamePartTooLongException,
100+
NonUniqueNameException,
101+
ServiceNameAlreadyRegistered,
102+
)
103+
94104

95105
__author__ = 'Paul Scott-Murphy, William McBrine'
96106
__maintainer__ = 'Jakub Stasiak <jakub@stasiak.at>'
@@ -306,37 +316,6 @@ def instance_name_from_service_info(info: "ServiceInfo") -> str:
306316
return info.name[: -len(service_name) - 1]
307317

308318

309-
# Exceptions
310-
311-
312-
class Error(Exception):
313-
pass
314-
315-
316-
class IncomingDecodeError(Error):
317-
pass
318-
319-
320-
class NonUniqueNameException(Error):
321-
pass
322-
323-
324-
class NamePartTooLongException(Error):
325-
pass
326-
327-
328-
class AbstractMethodException(Error):
329-
pass
330-
331-
332-
class BadTypeInNameException(Error):
333-
pass
334-
335-
336-
class ServiceNameAlreadyRegistered(Error):
337-
pass
338-
339-
340319
# implementation classes
341320

342321

zeroconf/exceptions.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
""" Multicast DNS Service Discovery for Python, v0.14-wmcbrine
2+
Copyright 2003 Paul Scott-Murphy, 2014 William McBrine
3+
4+
This module provides a framework for the use of DNS Service Discovery
5+
using IP multicast.
6+
7+
This library is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU Lesser General Public
9+
License as published by the Free Software Foundation; either
10+
version 2.1 of the License, or (at your option) any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public
18+
License along with this library; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20+
USA
21+
"""
22+
23+
# Exceptions
24+
25+
26+
class Error(Exception):
27+
pass
28+
29+
30+
class IncomingDecodeError(Error):
31+
pass
32+
33+
34+
class NonUniqueNameException(Error):
35+
pass
36+
37+
38+
class NamePartTooLongException(Error):
39+
pass
40+
41+
42+
class AbstractMethodException(Error):
43+
pass
44+
45+
46+
class BadTypeInNameException(Error):
47+
pass
48+
49+
50+
class ServiceNameAlreadyRegistered(Error):
51+
pass

0 commit comments

Comments
 (0)