Enum subplot::SubplotError[][src]

pub enum SubplotError {
Show 37 variants BindingsFileNotFound(PathBuf, Error), FunctionsFileNotFound(PathBuf, Error), UnknownSimplePatternKind(String), SimplePatternKindMismatch(String), StrayBraceInSimplePattern(String), SimplePatternHasMetaCharacters(String), BindingUnknown(String), BindingNotUnique(String, MatchedSteps), BindingWithoutKnownKeyword(String), BindingHasManyKeywords(String), UnknownTypeInBinding(String), ChildNoStdin, ChildFailed(String), NoFunction(String), NoTitle, MissingTemplate, NotJson, ScenarioBeforeHeading, NoStepKeyword(String), UnknownStepKind(String), ContinuationTooEarly, DuplicateEmbeddedFilename(String), RepeatedAddNewlineAttribute(String), UnrecognisedAddNewline(String, String), BasedirError(PathBuf), OutputDirectoryNotFound(String), NoTemplateSpecDirectory(PathBuf), TemplateError(String, Error), UnknownClasses(String), TemplateNoRun, EmbeddedFileNotFound(String), PikchrRenderError(String), IoError { source: Error, }, PandocError { source: PandocError, }, RegexError { source: Error, }, JsonError { source: Error, }, YamlError { source: Error, },
}
Expand description

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

Variants

BindingsFileNotFound

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

Tuple Fields of BindingsFileNotFound

0: PathBuf1: Error
FunctionsFileNotFound

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

Tuple Fields of FunctionsFileNotFound

0: PathBuf1: Error
UnknownSimplePatternKind

The simple pattern specifies a kind that is unknown.

Tuple Fields of UnknownSimplePatternKind

0: String
SimplePatternKindMismatch

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

Tuple Fields of SimplePatternKindMismatch

0: String
StrayBraceInSimplePattern

The simple pattern contains a stray { or }.

Tuple Fields of StrayBraceInSimplePattern

0: String
SimplePatternHasMetaCharacters

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.

Tuple Fields of SimplePatternHasMetaCharacters

0: String
BindingUnknown

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.

Tuple Fields of BindingUnknown

0: String
BindingNotUnique

Scenario step matches more than one binding

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

Tuple Fields of BindingNotUnique

0: String1: MatchedSteps
BindingWithoutKnownKeyword

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

Tuple Fields of BindingWithoutKnownKeyword

0: String
BindingHasManyKeywords

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

Tuple Fields of BindingHasManyKeywords

0: String
UnknownTypeInBinding

A binding lists an unknown type in its type map

Tuple Fields of UnknownTypeInBinding

0: String
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

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.

Tuple Fields of ChildFailed

0: String
NoFunction

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.

Tuple Fields of NoFunction

0: String
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, add a template field.

NotJson

Pandoc AST is not JSON

Subplot acts as a Pandoc filter, and as part of that Pandoc constructs an abstract syntax tree from the input document, and feeds it to the filter as JSON. However, when Subplot was parsing the AST, it wasn’t JSON.

This probably means there’s something wrong with Pandoc, it’s Rust bindings, or Subplot.

ScenarioBeforeHeading

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

Step does not have a keyword.

Tuple Fields of NoStepKeyword

0: String
UnknownStepKind

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.

Tuple Fields of UnknownStepKind

0: String
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.

DuplicateEmbeddedFilename

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.

Tuple Fields of DuplicateEmbeddedFilename

0: String
RepeatedAddNewlineAttribute

Embedded file has more than one add-newline attribute

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

Tuple Fields of RepeatedAddNewlineAttribute

0: String
UnrecognisedAddNewline

Unrecognised add-newline attribute value on an embedded file

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

Tuple Fields of UnrecognisedAddNewline

0: String1: String
BasedirError

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.

Tuple Fields of BasedirError

0: PathBuf
OutputDirectoryNotFound

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.

Tuple Fields of OutputDirectoryNotFound

0: String
NoTemplateSpecDirectory

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.

Tuple Fields of NoTemplateSpecDirectory

0: PathBuf
TemplateError

A code template has an error.

Tuple Fields of TemplateError

0: String1: Error
UnknownClasses

Unknown classes in use in document

Tuple Fields of UnknownClasses

0: String
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

An embedded file was not found.

Tuple Fields of EmbeddedFileNotFound

0: String
PikchrRenderError

When rendering a pikchr, something went wrong.

Tuple Fields of PikchrRenderError

0: String
IoError

I/O error

Subplot did some I/O, and it failed. This is a generic wrapper for any kind of I/O error.

Fields of IoError

source: Error

The wrapped error.

PandocError

Pandoc error

Subplot got an error from Panoc. This is a generic wrapper for any kinds of Pandoc errors.

Fields of PandocError

source: PandocError

The wrapped error.

RegexError

Regular expression error

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

Fields of RegexError

source: Error

The wrapped error.

JsonError

JSON error

Subplot parses and generates JSON. This is a generic wrapper for any kinds of errors related to that.

Fields of JsonError

source: Error

The wrapped error.

YamlError

YAML error

Subplot parses YAML. This is a generic wrapper for any kinds of errors related to that.

Fields of YamlError

source: Error

The wrapped error.

Implementations

Construct a ChildFailed error.

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

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

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.