Coverage for pepdbagent/exceptions.py: 82%
78 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-01 22:07 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-01 22:07 +0000
1"""Custom error types"""
4class PEPDatabaseAgentError(Exception):
5 """Base error type for pepdbagent custom errors."""
7 def __init__(self, msg: str) -> None:
8 super(PEPDatabaseAgentError, self).__init__(msg)
11class SchemaError(PEPDatabaseAgentError):
12 def __init__(self) -> None:
13 super().__init__(
14 """PEP_db connection error! The schema of connected db is incorrect"""
15 )
18class RegistryPathError(PEPDatabaseAgentError):
19 def __init__(self, msg: str = "") -> None:
20 super().__init__(f"""Provided registry path is incorrect. {msg}""")
23class ProjectNotFoundError(PEPDatabaseAgentError):
24 def __init__(self, msg: str = "") -> None:
25 super().__init__(f"""Project does not exist. {msg}""")
28class ProjectUniqueNameError(PEPDatabaseAgentError):
29 def __init__(self, msg: str = "") -> None:
30 super().__init__(f"""{msg}""")
33class IncorrectDateFormat(PEPDatabaseAgentError):
34 def __init__(self, msg: str = "") -> None:
35 super().__init__(f"""Incorrect date format was provided. {msg}""")
38class FilterError(PEPDatabaseAgentError):
39 def __init__(self, msg: str = "") -> None:
40 super().__init__(f"""pepdbagent filter error. {msg}""")
43class ProjectNotInFavorites(PEPDatabaseAgentError):
44 """
45 Project doesn't exist in favorites
46 """
48 def __init__(self, msg: str = "") -> None:
49 super().__init__(f"""Project is not in favorites list. {msg}""")
52class ProjectAlreadyInFavorites(PEPDatabaseAgentError):
53 """
54 Project doesn't exist in favorites
55 """
57 def __init__(self, msg: str = "") -> None:
58 super().__init__(f"""Project is already in favorites list. {msg}""")
61class SampleNotFoundError(PEPDatabaseAgentError):
62 def __init__(self, msg: str = "") -> None:
63 super().__init__(f"""Sample does not exist. {msg}""")
66class SampleTableUpdateError(PEPDatabaseAgentError):
67 def __init__(self, msg: str = "") -> None:
68 super().__init__(f"""Sample table update error. {msg}""")
71class ProjectDuplicatedSampleGUIDsError(SampleTableUpdateError):
72 def __init__(self, msg: str = "") -> None:
73 super().__init__(f"""Project has duplicated sample GUIDs. {msg}""")
76class SampleAlreadyExistsError(PEPDatabaseAgentError):
77 def __init__(self, msg: str = "") -> None:
78 super().__init__(f"""Sample already exists. {msg}""")
81class ViewNotFoundError(PEPDatabaseAgentError):
82 def __init__(self, msg: str = "") -> None:
83 super().__init__(f"""View does not exist. {msg}""")
86class SampleNotInViewError(PEPDatabaseAgentError):
87 def __init__(self, msg: str = "") -> None:
88 super().__init__(f"""Sample is not in the view. {msg}""")
91class SampleAlreadyInView(PEPDatabaseAgentError):
92 """
93 Sample is already in the view exception
94 """
96 def __init__(self, msg: str = "") -> None:
97 super().__init__(f"""Sample is already in the view. {msg}""")
100class ViewAlreadyExistsError(PEPDatabaseAgentError):
101 """
102 View is already in the project exception
103 """
105 def __init__(self, msg: str = "") -> None:
106 super().__init__(f"""View already in the project. {msg}""")
109class NamespaceNotFoundError(PEPDatabaseAgentError):
110 def __init__(self, msg: str = "") -> None:
111 super().__init__(f"""Project does not exist. {msg}""")
114class HistoryNotFoundError(PEPDatabaseAgentError):
115 def __init__(self, msg: str = "") -> None:
116 super().__init__(f"""History does not exist. {msg}""")
119class UserNotFoundError(PEPDatabaseAgentError):
120 def __init__(self, msg: str = "") -> None:
121 super().__init__(f"""User does not exist. {msg}""")
124class SchemaDoesNotExistError(PEPDatabaseAgentError):
125 def __init__(self, msg: str = "") -> None:
126 super().__init__(f"""Schema does not exist. {msg}""")
129class SchemaAlreadyExistsError(PEPDatabaseAgentError):
130 def __init__(self, msg: str = "") -> None:
131 super().__init__(f"""Schema already exists. {msg}""")
134class SchemaVersionDoesNotExistError(PEPDatabaseAgentError):
135 def __init__(self, msg: str = "") -> None:
136 super().__init__(f"""Schema version does not exist. {msg}""")
139class SchemaVersionAlreadyExistsError(PEPDatabaseAgentError):
140 def __init__(self, msg: str = "") -> None:
141 super().__init__(f"""Schema version already exists. {msg}""")
144class SchemaTagDoesNotExistError(PEPDatabaseAgentError):
145 def __init__(self, msg: str = "") -> None:
146 super().__init__(f"""Schema tag does not exist. {msg}""")
149class SchemaTagAlreadyExistsError(PEPDatabaseAgentError):
150 def __init__(self, msg: str = "") -> None:
151 super().__init__(f"""Schema tag already exists. {msg}""")