pub enum AddLessonError {
InvalidId(String),
NotACourse(PathBuf),
AlreadyExists(PathBuf),
Write(Error),
}Expand description
Why a lesson could not be added to a course.
The three refusals are kept distinct from a genuine write failure so the cli
can frame each: an InvalidId, a
NotACourse, or an
AlreadyExists is a user-correctable refusal
caught at the boundary before any write, whereas a
Write is an underlying I/O fault.
Variants§
InvalidId(String)
The lesson id is not a safe slug (empty, or containing a path separator,
.., whitespace, or punctuation), so it is refused before any write
(§1.3.1) rather than escaping the course’s lessons/ directory or
breaking the manifest’s TOML. Carries the rejected id.
NotACourse(PathBuf)
The target directory is not a course: it has no blendtutor.toml to
register the lesson in, so the add is refused before any write (§1.3.1)
rather than leaving an orphan lesson in a non-course directory. Carries the
directory. (Run blendtutor init first, or cd into a course.)
AlreadyExists(PathBuf)
A file already exists at the target path — the lesson itself, or its
eval_-prefixed sibling suite — so the command refuses to overwrite it
(no clobber), before any write to that path. Carries the course-relative
path that is already taken.
Write(Error)
A filesystem operation failed while writing the lesson file or registering it in the manifest.