summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2022-07-30 16:58:44 +0300
committerAlex Grönholm <alex.gronholm@nextday.fi>2022-07-30 16:58:44 +0300
commit214b8add6e12c9c54a6d3e34ced0f009250c3bc0 (patch)
treef2b3b87d8b2f79f3f54b29e704a5c055285a6652 /src
parentddfb74ba155b5276c6b1ef70782186d701fd1fe7 (diff)
downloadapscheduler-214b8add6e12c9c54a6d3e34ced0f009250c3bc0.tar.gz
Refactored the apscheduler.exceptions module
Removed unused exceptions, adjusted the inheritance of some remaining ones.
Diffstat (limited to 'src')
-rw-r--r--src/apscheduler/exceptions.py49
1 files changed, 15 insertions, 34 deletions
diff --git a/src/apscheduler/exceptions.py b/src/apscheduler/exceptions.py
index 21af6cd..4e680e6 100644
--- a/src/apscheduler/exceptions.py
+++ b/src/apscheduler/exceptions.py
@@ -10,14 +10,21 @@ class TaskLookupError(LookupError):
super().__init__(f"No task by the id of {task_id!r} was found")
-class JobLookupError(KeyError):
+class ScheduleLookupError(LookupError):
+ """Raised by a scheduler when it cannot find the requested schedule."""
+
+ def __init__(self, schedule_id: str):
+ super().__init__(f"No schedule by the id of {schedule_id!r} was found")
+
+
+class JobLookupError(LookupError):
"""Raised when the job store cannot find a job for update or removal."""
def __init__(self, job_id: UUID):
super().__init__(f"No job by the id of {job_id} was found")
-class JobResultNotReady(KeyError):
+class JobResultNotReady(Exception):
"""Raised by ``get_job_result()`` if the job result is not ready."""
def __init__(self, job_id: UUID):
@@ -34,26 +41,14 @@ class JobDeadlineMissed(Exception):
class ConflictingIdError(KeyError):
"""
- Raised when trying to add a schedule to a store that already contains a schedule by that ID,
- and the conflict policy of ``exception`` is used.
+ Raised when trying to add a schedule to a store that already contains a schedule by
+ that ID, and the conflict policy of ``exception`` is used.
"""
def __init__(self, schedule_id):
super().__init__(
- f"This data store already contains a schedule with the identifier {schedule_id!r}"
- )
-
-
-class TransientJobError(ValueError):
- """
- Raised when an attempt to add transient (with no func_ref) job to a persistent job store is
- detected.
- """
-
- def __init__(self, job_id):
- super().__init__(
- f"Job ({job_id}) cannot be added to this job store because a reference to the "
- f"callable could not be determined."
+ f"This data store already contains a schedule with the identifier "
+ f"{schedule_id!r}"
)
@@ -67,20 +62,6 @@ class DeserializationError(Exception):
class MaxIterationsReached(Exception):
"""
- Raised when a trigger has reached its maximum number of allowed computation iterations when
- trying to calculate the next fire time.
+ Raised when a trigger has reached its maximum number of allowed computation
+ iterations when trying to calculate the next fire time.
"""
-
-
-class SchedulerAlreadyRunningError(Exception):
- """Raised when attempting to start or configure the scheduler when it's already running."""
-
- def __str__(self):
- return "Scheduler is already running"
-
-
-class SchedulerNotRunningError(Exception):
- """Raised when attempting to shutdown the scheduler when it's not running."""
-
- def __str__(self):
- return "Scheduler is not running"