diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/apscheduler/exceptions.py | 49 |
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" |