summaryrefslogtreecommitdiff
path: root/src/error.rs
AgeCommit message (Collapse)AuthorFilesLines
2023-12-27bindings: Add warnings for missing capture names or missing capture typesDaniel Silverstone1-0/+8
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2023-12-25refactor: move CSS file out of doc.rsLars Wirzenius1-0/+4
Make it easier to edit the CSS file, and also add some styles for upcoming scenario typesetting. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
2023-12-01feat: make libdocgen fail if a binding lacks a doc stringLars Wirzenius1-0/+7
The --merciful option allows this if the user really wants it. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
2023-06-10feat: Warn when named codeblocks lack classesDaniel Silverstone1-0/+4
To both improve debugability when writing scenarios, and also to protect against future incompatibilities which might occur if we add more classes which are appropriate for named code blocks, we require that named blocks have one of `file` or `example` as classes or else we warn. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2023-06-07feat! don't allow indented scenario stepsLars Wirzenius1-0/+4
Some day we will have syntax for continuing a step to the next line. This change makes it easier to introduce that syntax, without a breaking change. Sponsored-by: author
2023-05-19chore: drop unused SubplotError::AstLars Wirzenius1-4/+0
Sponsored-by: author
2023-05-19feat: add location information to markdown parsing errorsLars Wirzenius1-3/+3
Sponsored-by: author
2023-05-14feat: check for duplicate scenario titlesLars Wirzenius1-0/+7
Sponsored-by: author
2023-04-08chore(src/error.rs): drop unused error variantsLars Wirzenius1-20/+0
Sponsored-by: author
2023-04-08feat! convert markdown parsing to use pulldown_cmarkLars Wirzenius1-0/+14
This doesn't compile yet. Sponsored-by: author
2023-02-25(Warnings): Add is_empty() and len()Daniel Silverstone1-0/+10
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2023-01-28refactor: move YamlMetadata to src/metadata.rsLars Wirzenius1-1/+1
YamlMetadata was in src/ast.rs, because originally it was only used to parse metadata out of Markdown. Markdown parsing is now in its own module, leaving ast.rs to only contain YamlMetadata. In this situation, it seems tidy to have both kinds of metadata in the same module, and to drop the now-empty ast.rs module. Sponsored-by: author
2022-10-21fix: say for which file lookup of input file mtime failsLars Wirzenius1-0/+8
Sponsored-by: author
2022-09-06feat! read document metadata from a YAML fileLars Wirzenius1-0/+4
This is a huge change all in one commit, sorry. However, as it changes a fundamental part of the command line interface (namely, what constitutes as the input file), there doesn't seem a way to break this into a tidy series of small commits. Most of the diff is in subplot.md, where every scenario that invokes Subplot needs multiple changes, thus touching much of the file. The overall change is that where we previously had document metadata in embedded YAML in the Markdown file, we now have it in a separate YAML file. The Markdown file is named in the YAML file. We still parse the Markdown with Pandoc for everything, except codegen. Switching from Pandoc to pulldown_cmark for parsing will be another big change that I didn't want to include in this huge change set. Sponsored-by: author
2022-08-13Merge branch 'liw/refactor-errors' into 'main'Daniel Silverstone1-7/+11
feat: make errors have a source error See merge request subplot/subplot!284
2022-08-13feat: make errors have a source errorLars Wirzenius1-7/+11
When errors have a source, i.e., an underlying error, it results in better error messages to the user. Also, refactor the way the source chain is printed, to code that is clearer to me. I will need this to for loading document metadata from an external YAML file. Sponsored-by: author
2022-07-30chore: handle write! errorsLars Wirzenius1-0/+4
Sponsored-by: author
2022-05-06refactor: replace SubplotError::JsonError with a more specific oneLars Wirzenius1-10/+3
SubplotError::JsonError is a generic error, but we actually only parse JSON when parsing the AST from Pandoc. Replace it with a ::AstJson error to be more specific, and hopefully more helpful to the user. Sponsored-by: author
2022-05-06refactor: replace SubplotError::RegexError with a simpler oneLars Wirzenius1-6/+2
SubplotError::RegexError was a struct variant in the enum. Replace it with a more usual variant with the regex::Error as a source field, for better error messaging. Sponsored-by: author
2022-05-06refactor: replace SubplotError::YamlError with more specific oneLars Wirzenius1-10/+3
SubplotError::YamlError is quite generic. We only parse YAML as part of document metadata, so replace the error with a more specific one. Sponsored-by: author
2022-05-06refactor: replace generic Pandoc error with specificLars Wirzenius1-10/+3
Replace SubplotError::PandocError with ::Pandoc, which is only for executing the Pandoc program. In reality, so was the old variant, but the new one is more specific, and also embeds the error from executing Pandoc as a source error. The error message is still crap, but that will be fixed later by not using Pandoc for parsing Markdown. Sponsored-by: author
2022-05-06refactor! split SubplotError::IoError into more specific errorsLars Wirzenius1-10/+23
Replace SubplotError::IoError with ::Spawn, ::WriteToChild, ::WaitForChild, ::ReadFile, ::CreateFile, ::Writefile. IoError was a catchall error and as such, so generic that it didn't help the user to figure out what actually is wrong. For example, there was no indication what operation was attempted or on what file. The new error variants are specific. Sponsored-by: author
2022-05-05refactor: drop the subplot::Result type aliasLars Wirzenius1-3/+0
Replace subplot::Result<T> with Result<T, SubplotError>. I find this now to be clearer, as I don't need to remind myself which Result is being used where. This should not be a breaking change. Sponsored-by: author
2022-04-10feat: report markup problems during typesetting as a warningLars Wirzenius1-0/+12
Sponsored-by: author
2022-04-10feat: make typesetting issues into warningsLars Wirzenius1-1/+10
Sponsored-by: author
2022-04-10feat! treat warnings as errors by defaultLars Wirzenius1-3/+12
Add a --merciful option to subcommands for which this matters. Adjust tests to invoke subplot with that option as necessary. Sponsored-by: author
2022-04-10refactor: collect warnings for a document in its DocumentLars Wirzenius1-0/+36
Change places where warnings used to be written out so the warnings are pushed into the list in Document instead. Sponsored-by: author
2021-12-27codegen: Refuse to generate code if the specified template is not presentDaniel Silverstone1-0/+9
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-11-19various: Rework document to support multiple implementationsDaniel Silverstone1-1/+10
In order to eventually shift the document metadata to support more than one template defined for the document this reworks all the internal APIs to expect templates, and also the external CLI to be able to provide it. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-10-08codegen: Refuse to codegen if there are zero scenariosDaniel Silverstone1-0/+4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-09-16feat! parse Markdown input with pull-cmark instead of PandocLars Wirzenius1-1/+9
This is a first step towards being able to use Subplot codegen from a project's build.rs, and with only pure-Rust build dependencies. Replace Pandoc for parsing Markdown input with pulldown-cmark. This is mostly a drop-in replacement, but not entirely. The YAML parsing is more strict now. Note that this is a breaking change. Some subplots that used to work, and still work with docgen, no longer work with the new parser. Major differences are: * Only specific fields are supported. All the Markdown files in the Subplot source tree work. If anything else is needed, and it likely is, the new parser needs to be extended. * The bindings, functions, classes, and bibliography fields MUST be lists of strings. A single string value will no longer work. Sponsored-by: pep.foundation
2021-09-04bindings: Example chained error for parsing bindingsDaniel Silverstone1-0/+4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-07-20feat: when more than one bindings match a step, list all of themLars Wirzenius1-2/+4
Sponsored-by: author
2021-04-14refactor: don't use anyhow in the library part of the crateLars Wirzenius1-1/+5
Add one variant to the SubplotError enum and change src/codegen.rs to return Result<_, SubplotError> instead of anyhow::Result<_>.
2020-12-18bindings: Add check that captured text matches the kind patternsDaniel Silverstone1-0/+4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-12-18bindings: Use/amend the typemap when parsing simple patternsDaniel Silverstone1-0/+4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-12-03codegen: Make template metadata entry mandatoryDaniel Silverstone1-0/+9
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-11-04graphmarkup: Add pikchr rendererDaniel Silverstone1-0/+4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-09-26add: simple word pattern kindsLars Wirzenius1-0/+4
2020-06-20Merge branch 'extract' into 'master'Daniel Silverstone1-0/+4
Add sp-extract Closes #41 See merge request larswirzenius/subplot!53
2020-06-20Apply 1 suggestion(s) to 1 file(s)Lars Wirzenius1-1/+1
2020-06-08feat: add sp-extract for extracting data files from subplotsLars Wirzenius1-0/+4
2020-06-06feat: Support reporting error when more than one binding matches a stepDaniel Silverstone1-0/+7
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-06-06fix: report name of missing bindings or functions file in error msgLars Wirzenius1-0/+8
2020-05-24feat: Add linting for add-newline attributeDaniel Silverstone1-0/+14
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-05-24errors: Add error case for regex metacharacters detectedDaniel Silverstone1-0/+8
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-05-09Merge branch 'keepkeyword' into 'master'Daniel Silverstone1-3/+7
Change: keep actual text of keyword from scenario Closes #24 See merge request larswirzenius/subplot!38
2020-05-09Change: keep actual text of keyword from scenarioLars Wirzenius1-3/+7
The typesetting should preserve the actual keyword or alias in the source. Previously, if source had this: ``` given foo and bar ``` it got typeset as if were: ``` given foo given bar ``` Also, change subplot.md to use alias when possible.
2020-05-09Change: use a base directory for relative pathsLars Wirzenius1-0/+9
This moves the policy decision of what the base directory is to the main functions of the various programs, instead of hiding it deep in the call stack and making it implicitly the current working directory.
2020-05-08error: Add UnknownClasses errorDaniel Silverstone1-0/+4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>