From 546451e019dd70f50ef487867148100b3cfa511c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Mon, 26 Sep 2022 17:29:17 +0200 Subject: [PATCH] fix(lib): add a more meaningful error message (#30) * fix(lib): add a more meaningful error message This adds an error message to explain why calling `self.pause()` cannot work if no previous animation was played. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- manim_slides/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manim_slides/config.py b/manim_slides/config.py index 9d57f07..32c4298 100644 --- a/manim_slides/config.py +++ b/manim_slides/config.py @@ -84,6 +84,11 @@ class SlideConfig(BaseModel): def start_animation_is_before_end(cls, values): if values["start_animation"] >= values["end_animation"]: + if values["start_animation"] == values["end_animation"] == 0: + raise ValueError( + "You have to play at least one animation (e.g., `self.wait()`) before pausing. If you want to start paused, use the approriate command-line option when presenting." + ) + raise ValueError( "Start animation index must be strictly lower than end animation index" )