Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: tidy up exceptions #762

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 4 additions & 25 deletions src/dsp_tools/models/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ def __init__(self, custom_msg: str | None = None, keep_default_msg: bool = True)


class RetryError(BaseError):
"""
A class for errors where the user should try again later.
"""
"""A class for errors where the user should try again later."""

def __init__(self, custom_msg: str | None = None, keep_default_msg: bool = True) -> None:
default_msg = (
Expand All @@ -68,9 +66,7 @@ def __init__(self, custom_msg: str | None = None, keep_default_msg: bool = True)


class InputError(BaseError):
"""
Class for errors that is called when the user input is invalid.
"""
"""Class for errors that is called when the user input is invalid."""


class UserError(BaseError):
Expand All @@ -83,25 +79,8 @@ class UserError(BaseError):


class PermanentConnectionError(BaseError):
"""
This error is raised when all attempts to reconnect to DSP have failed.

Attributes:
message: A message that describes the error
"""

message: str
"""This error is raised when all attempts to reconnect to DSP have failed."""


class XmlUploadError(BaseError):
"""
Represents an error raised in the context of the XML import.
"""

_message: str

def __init__(self, msg: str):
self._message = msg

def __str__(self) -> str:
return f"XML-ERROR: {self._message}"
jnussbaum marked this conversation as resolved.
Show resolved Hide resolved
"""Represents an error raised in the context of the xmlupload."""