mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-09 02:42:30 -05:00
Move private things in modlog and redbot.core.errors (#6020)
This commit is contained in:
@@ -18,7 +18,7 @@ except ModuleNotFoundError:
|
||||
pymongo = None
|
||||
|
||||
from .. import errors
|
||||
from .base import BaseDriver, IdentifierData
|
||||
from .base import BaseDriver, IdentifierData, MissingExtraRequirements
|
||||
|
||||
__all__ = ["MongoDriver"]
|
||||
|
||||
@@ -33,7 +33,7 @@ class MongoDriver(BaseDriver):
|
||||
@classmethod
|
||||
async def initialize(cls, **storage_details) -> None:
|
||||
if motor is None:
|
||||
raise errors.MissingExtraRequirements(
|
||||
raise MissingExtraRequirements(
|
||||
"Red must be installed with the [mongo] extra to use the MongoDB driver"
|
||||
)
|
||||
uri = storage_details.get("URI", "mongodb")
|
||||
|
||||
@@ -6,7 +6,11 @@ import rich.progress
|
||||
|
||||
from redbot.core.utils._internal_utils import RichIndefiniteBarColumn
|
||||
|
||||
__all__ = ["BaseDriver", "IdentifierData", "ConfigCategory"]
|
||||
__all__ = ("BaseDriver", "IdentifierData", "ConfigCategory", "MissingExtraRequirements")
|
||||
|
||||
|
||||
class MissingExtraRequirements(Exception):
|
||||
"""Raised when an extra requirement is missing but required."""
|
||||
|
||||
|
||||
class ConfigCategory(str, enum.Enum):
|
||||
|
||||
@@ -11,7 +11,7 @@ except ModuleNotFoundError:
|
||||
asyncpg = None
|
||||
|
||||
from ... import data_manager, errors
|
||||
from ..base import BaseDriver, IdentifierData, ConfigCategory
|
||||
from ..base import BaseDriver, IdentifierData, ConfigCategory, MissingExtraRequirements
|
||||
from ..log import log
|
||||
|
||||
__all__ = ["PostgresDriver"]
|
||||
@@ -41,7 +41,7 @@ class PostgresDriver(BaseDriver):
|
||||
@classmethod
|
||||
async def initialize(cls, **storage_details) -> None:
|
||||
if asyncpg is None:
|
||||
raise errors.MissingExtraRequirements(
|
||||
raise MissingExtraRequirements(
|
||||
"Red must be installed with the [postgres] extra to use the PostgreSQL driver"
|
||||
)
|
||||
cls._pool = await asyncpg.create_pool(**storage_details)
|
||||
|
||||
Reference in New Issue
Block a user