md2star.errors module
md2star — typed exceptions for the CLI / pipeline.
Two purposes:
Carry an actionable hint. Every subclass takes a
hint=keyword whose string is printed below the headline error so the user knows what to do, not just what went wrong. The CLI’s top-level handler renders this as a multi-line block (seemd2star.cli.handle_known_error()) instead of a Python stacktrace.Mark which failures are “expected”. Anything that subclasses
Md2starErroris something we predicted and want to render cleanly. Anything else genuinely is a bug and the CLI re-raises with the original traceback so the user can file an issue.
- exception md2star.errors.ConversionError(message, *, hint=None)[source]
Bases:
Md2starErrorPandoc / soffice / mermaid-cli exited non-zero.
Wraps the failing subprocess’s stderr so the user sees the real cause without us re-rendering a Python traceback.
- exception md2star.errors.InvalidInputError(message, *, hint=None)[source]
Bases:
Md2starErrorInput file doesn’t exist, isn’t readable, or has a wrong extension.
- exception md2star.errors.Md2starError(message, *, hint=None)[source]
Bases:
ExceptionBase class for every md2star-defined, user-actionable error.
The CLI top-level handler renders these with the
hintstring on a second line and exits non-zero. Subclasses set a sensiblehintdefault so callers don’t have to repeat the boilerplate.
- exception md2star.errors.MissingDependencyError(message, *, hint=None)[source]
Bases:
Md2starErrorRequired external program (pandoc, soffice, node, …) not found on PATH.
Raised when md2star is about to invoke a system binary that is not installed. Carries the binary name and the suggested install command.
- exception md2star.errors.RemoteResourceDisabledError(message, *, hint=None)[source]
Bases:
Md2starErrorAn online fetch was needed but blocked by –offline.
Remote images stay opt-in (
--allow-remote-images). Remote templates are fetched by default (v2.5.0+);--offlineis the hard kill-switch that blocks every network touch, and the CLI surfaces that here.
- exception md2star.errors.TemplateNotFoundError(message, *, hint=None)[source]
Bases:
Md2starErrorRequested reference template (template.docx / template.pptx) not located.
Distinct from a missing bundled template (which is a
MissingDependencyErrorbecause it means the wheel is corrupted). This one fires when the user asks for a template that isn’t where they said it’d be.
- exception md2star.errors.UnsafePathError(message, *, hint=None)[source]
Bases:
Md2starErrorFilesystem path escapes the operation’s sandbox (GUI folder browser).