pub enum SubplotError {
Show 55 variants NotAtBoln(String), Warnings(usize), BindingsFileNotFound(PathBuf, Error), FunctionsFileNotFound(PathBuf, Error), UnknownSimplePatternKind(String), SimplePatternKindMismatch(String), StrayBraceInSimplePattern(String), SimplePatternHasMetaCharacters(String), BindingFileParseError(PathBuf, Box<SubplotError>), BindingUnknown(String), BindingNotUnique(String, MatchedSteps), BindingWithoutKnownKeyword(String), BindingHasManyKeywords(String), UnknownTypeInBinding(String), ChildNoStdin, ChildFailed(String), NoFunction(String), NoTitle, MissingTemplate, AmbiguousTemplate, TemplateSupportNotPresent, ScenarioBeforeHeading(Location), NoStepKeyword(String), UnknownStepKind(String), ContinuationTooEarly, DuplicateScenario(String), DuplicateEmbeddedFilename(String), RepeatedAddNewlineAttribute(String), UnrecognisedAddNewline(String, String), BasedirError(PathBuf), OutputDirectoryNotFound(String), NoTemplateSpecDirectory(PathBuf), TemplateError(String, Error), UnknownClasses(String), TemplateNoRun, EmbeddedFileNotFound(String), PikchrRenderError(String), NoScenariosMatched(String), Spawn(PathBuf, Error), WriteToChild(Error), WaitForChild(Error), ReadFile(PathBuf, Error), CreateFile(PathBuf, Error), WriteFile(PathBuf, Error), ParseMarkdown(HtmlError), Regex(String, Error), Metadata(Error), MetadataFile(PathBuf, Error), FileUtf8(PathBuf, FromUtf8Error), Utf8Error(Utf8Error), MdError(MdError), StringFormat(Error), InputFileUnreadable(PathBuf, Error), InputFileMtime(PathBuf, Error), Roadmap(RoadmapError),
}
Expand description

Define all the kinds of errors any part of this crate can return.

Variants§

§

NotAtBoln(String)

Scenario step does not start at the beginning of the line.

§

Warnings(usize)

Document has non-fatal errors.

§

BindingsFileNotFound(PathBuf, Error)

Subplot could not find a file named as a bindings file.

§

FunctionsFileNotFound(PathBuf, Error)

Subplot could not find a file named as a functions file.

§

UnknownSimplePatternKind(String)

The simple pattern specifies a kind that is unknown.

§

SimplePatternKindMismatch(String)

The simple pattern and the type map disagree over the kind of a match

§

StrayBraceInSimplePattern(String)

The simple pattern contains a stray { or }.

§

SimplePatternHasMetaCharacters(String)

The simple pattern has regex metacharacters.

Simple patterns are not permitted to have regex metacharacters in them unless the pattern is explicitly marked regex: false to indicate that the binding author understands what they’re up to.

§

BindingFileParseError(PathBuf, Box<SubplotError>)

Error while parsing a bindings file

§

BindingUnknown(String)

Scenario step does not match a known binding

This may be due to the binding missing entirely, or that the step or the binding has a typo, or that a pattern in the binding doesn’t match what the author thinks it matches.

§

BindingNotUnique(String, MatchedSteps)

Scenario step matches more than one binding

THis may be due to bindings being too general, or having unusual overlaps in their matching

§

BindingWithoutKnownKeyword(String)

A binding in the bindings file doesn’t specify a known keyword.

§

BindingHasManyKeywords(String)

A binding has more than one keyword (given/when/then).

§

UnknownTypeInBinding(String)

A binding lists an unknown type in its type map

§

ChildNoStdin

Subplot tried to use a program, but couldn’t feed it data

Subplot uses some helper programs to implement some of its functionality, for example the GraphViz dot program. This error means that when tried to start a helper program and write to the helper’s standard input stream, it failed to get the stream.

This probably implies there’s something wrong on your system.

§

ChildFailed(String)

Subplot helper program failed

Subplot uses some helper programs to implement some of its functionality, for example the GraphViz dot program. This error means that the helper program failed (exit code was not zero).

This probably implies there’s something wrong in Subplot. Please report this error to the Subplot project.

§

NoFunction(String)

Binding doesn’t define a function

All binding must define the name of the function that implements the step. The bindings file has at least one binding that doesn’t define one. To fix, add a function: field to the binding.

§

NoTitle

Document has no title

The document YAML metadata does not define a document title. To fix, add a title field.

§

MissingTemplate

Document has no template

The document YAML metadata does not define the template to use during code generation.

To fix, ensure an appropriate impl entry is present.

§

AmbiguousTemplate

Document has more than one template

The document YAML metadata specifies more than one possible template implementation to be used during code generation.

To fix, specify --template on the codegen CLI.

§

TemplateSupportNotPresent

Document does not support the requested template

The document YAML metadata does not specify support for the stated template.

To fix, specify a template which is provided for in the document.

§

ScenarioBeforeHeading(Location)

First scenario is before first heading

Subplot scenarios are group by the input document’s structure. Each scenario must be in a chapter, section, subsection, or other structural element with a heading. Subplot found a scenario block before the first heading in the document.

To fix, add a heading or move the scenario after a heading.

§

NoStepKeyword(String)

Step does not have a keyword.

§

UnknownStepKind(String)

Unknown scenario step keyword.

Each scenario step must start with a known keyword (given, when, then, and, but), but Subplot didn’t find one it recognized.

This is usually due to a typing mistake or similar.

§

ContinuationTooEarly

Scenario step uses continuation keyword too early

If a continuation keyword (and or but) is used too early in a scenario (i.e. before any other keyword was used) then it cannot be resolved to whichever keyword it should have been.

§

DuplicateScenario(String)

Scenario has the same title as another scenario

Titles of scenarios must be unique in the input document, but Subplot found at least one with the same title as another.

§

DuplicateEmbeddedFilename(String)

Embedded file has the same name as another embedded file

Names of embedded files must be unique in the input document, but Subplot found at least one with the same name as another.

§

RepeatedAddNewlineAttribute(String)

Embedded file has more than one add-newline attribute

The add-newline attribute can only be specified once for any given embedded file

§

UnrecognisedAddNewline(String, String)

Unrecognised add-newline attribute value on an embedded file

The add-newline attribute can only take the values auto, yes, and no.

§

BasedirError(PathBuf)

Couldn’t determine base directory from input file name.

Subplot needs to to determine the base directory for files referred to by the markdown input file (e.g., bindings and functions files). It failed to do that from the name of the input file. Something weird is happening.

§

OutputDirectoryNotFound(String)

Output goes into a directory that does not exist.

Subplot needs to know in which directory it should write its output file, since it writes a temporary file first, then renames it to the final output file. The temporary file is created in the same directory as the final output file. However, Subplot could not find that directory.

§

NoTemplateSpecDirectory(PathBuf)

The template.yaml is not in a directory.

Template specifications reference files relative to the template.yaml file, but Subplot could not find the name of the directory containing the template.yaml file. Something is very weird.

§

TemplateError(String, Error)

A code template has an error.

§

UnknownClasses(String)

Unknown classes in use in document

§

TemplateNoRun

Template does not specify how to run generated program

The template.yaml file used does not specify how to run the generated program, but user asked codegen to run it.

§

EmbeddedFileNotFound(String)

An embedded file was not found.

§

PikchrRenderError(String)

When rendering a pikchr, something went wrong.

§

NoScenariosMatched(String)

When attempting to codegen, no scenarios matched the desired template language

§

Spawn(PathBuf, Error)

Failed to invoke a program.

§

WriteToChild(Error)

Failed to write to stdin of child process.

§

WaitForChild(Error)

Error when waiting for child process to finish.

§

ReadFile(PathBuf, Error)

Error when reading a file.

§

CreateFile(PathBuf, Error)

Error when creating a file.

§

WriteFile(PathBuf, Error)

Error when writing to a file.

§

ParseMarkdown(HtmlError)

Error parsing markdown into HTML.

§

Regex(String, Error)

Regular expression error

Subplot uses regular expressions. This is a generic wrapper for any kinds of errors related to that.

§

Metadata(Error)

Error parsing YAML metadata for document.

§

MetadataFile(PathBuf, Error)

Error parsing YAML metadata for document, from external file.

§

FileUtf8(PathBuf, FromUtf8Error)

UTF8 conversion error.

§

Utf8Error(Utf8Error)

UTF8 conversion error.

§

MdError(MdError)

Markdown errors.

§

StringFormat(Error)

String formatting failed.

§

InputFileUnreadable(PathBuf, Error)

Input file could not be read.

§

InputFileMtime(PathBuf, Error)

Input file mtime lookup.

§

Roadmap(RoadmapError)

Error typesetting a roadmap diagram.

Implementations§

source§

impl SubplotError

source

pub fn child_failed(msg: &str, output: &Output) -> SubplotError

Construct a ChildFailed error.

Trait Implementations§

source§

impl Debug for SubplotError

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for SubplotError

source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for SubplotError

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<HtmlError> for SubplotError

source§

fn from(source: HtmlError) -> Self

Converts to this type from the input type.
source§

impl From<MdError> for SubplotError

source§

fn from(source: MdError) -> Self

Converts to this type from the input type.
source§

impl From<RoadmapError> for SubplotError

source§

fn from(source: RoadmapError) -> Self

Converts to this type from the input type.
source§

impl From<Utf8Error> for SubplotError

source§

fn from(source: Utf8Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.