Skip to content

Commit

Permalink
rename FastMqttError to FastMQTTError
Browse files Browse the repository at this point in the history
  • Loading branch information
toxazhl committed Aug 15, 2024
1 parent 00f6bd2 commit ad960bb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions fastmqtt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .exceptions import FastMqttError
from .exceptions import FastMQTTError
from .fastmqtt import FastMQTT
from .router import MQTTRouter
from .types import (
Expand All @@ -19,5 +19,5 @@
"RetainHandling",
"SubscribeOptions",
"Subscription",
"FastMqttError",
"FastMQTTError",
]
2 changes: 1 addition & 1 deletion fastmqtt/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class FastMqttError(Exception):
class FastMQTTError(Exception):
pass
4 changes: 2 additions & 2 deletions fastmqtt/message_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from .connectors import BaseConnector
from .encoders import BaseDecoder
from .exceptions import FastMqttError
from .exceptions import FastMQTTError
from .properties import PublishProperties
from .subscription_manager import Subscription, SubscriptionManager
from .types import Message, Payload, RawMessage
Expand Down Expand Up @@ -59,7 +59,7 @@ async def _handle_result(self, result: Any, message: Message) -> None:
return

if message.properties.response_topic is None:
raise FastMqttError("Callback returned result, but message has no response_topic")
raise FastMQTTError("Callback returned result, but message has no response_topic")

response_properties = None
if message.properties.correlation_data is not None:
Expand Down
8 changes: 4 additions & 4 deletions fastmqtt/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from typing import TYPE_CHECKING, Any, Callable

from .exceptions import FastMqttError
from .exceptions import FastMQTTError
from .properties import PublishProperties
from .subscription_manager import SubscriptionWithId
from .types import Message, RetainHandling
Expand Down Expand Up @@ -89,16 +89,16 @@ async def request(
) -> Message:
correlation_data = self._correlation_generator()
if correlation_data in self._futures:
raise FastMqttError(f"correlation_data {correlation_data} already in use")
raise FastMQTTError(f"correlation_data {correlation_data} already in use")

if properties is None:
properties = PublishProperties()

if properties.correlation_data is not None:
raise FastMqttError("properties.correlation_data is not allowed in request")
raise FastMQTTError("properties.correlation_data is not allowed in request")

if properties.response_topic is not None:
raise FastMqttError("properties.response_topic is not allowed in request")
raise FastMQTTError("properties.response_topic is not allowed in request")

properties.correlation_data = correlation_data
properties.response_topic = self._response_topic
Expand Down
10 changes: 5 additions & 5 deletions fastmqtt/router.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from typing import Any, Callable

from .exceptions import FastMqttError
from .exceptions import FastMQTTError
from .types import CallbackType, RetainHandling, SubscribeOptions, Subscription

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -29,11 +29,11 @@ def merge_subscribe_options(
options_exist.qos = max(options_exist.qos, options_new.qos)

if options_exist.no_local != options_new.no_local:
raise FastMqttError("Different no_local options")
raise FastMQTTError("Different no_local options")
if options_exist.retain_as_published != options_new.retain_as_published:
raise FastMqttError("Different retain_as_published options")
raise FastMQTTError("Different retain_as_published options")
if options_exist.retain_handling != options_new.retain_handling:
raise FastMqttError("Different retain_handling options")
raise FastMQTTError("Different retain_handling options")


class MQTTRouter:
Expand Down Expand Up @@ -88,7 +88,7 @@ def register(
retain_handling: RetainHandling | None = None,
) -> Subscription:
if self._included:
raise FastMqttError(
raise FastMQTTError(
"Cannot register new subscriptions after router is included, "
"use fastmqtt.subscribe instead"
)
Expand Down
6 changes: 3 additions & 3 deletions fastmqtt/subscription_manager.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio

from .connectors import BaseConnector
from .exceptions import FastMqttError
from .exceptions import FastMQTTError
from .properties import SubscribeProperties
from .types import CallbackType, Subscription, SubscriptionWithId

Expand Down Expand Up @@ -70,7 +70,7 @@ async def subscribe_multiple(
self, subscriptions: list[Subscription]
) -> list[SubscriptionWithId]:
if self._id_manager.get_available_count() < len(subscriptions):
raise FastMqttError("Not enough subscription identifiers available")
raise FastMQTTError("Not enough subscription identifiers available")

await asyncio.sleep(0.1)
return await asyncio.gather(
Expand Down Expand Up @@ -98,7 +98,7 @@ async def unsubscribe(
)

if subscription is None:
raise FastMqttError("Subscription not found")
raise FastMQTTError("Subscription not found")

if callback is not None:
subscription.callbacks.remove(callback)
Expand Down

0 comments on commit ad960bb

Please sign in to comment.