Expand description
Shared error types used across parsing, config loading, and formatting. Structured error types returned by parsing, config loading, and formatting.
Every fallible crate API returns Result, which is
std::result::Result<T, Error>. The Error enum
distinguishes sources:
Error::Parse— CMake source failed to parse; line/column info is 1-based.Error::Config— a.cmakefmt.yaml|yml|toml(orfrom_yaml_strinput) failed to deserialise, or a programmaticcrate::Confighad an invalid regex pattern.Error::Spec— acommands:override file (or string) failed to deserialise, or the built-in spec file itself did.Error::Io— filesystem or stream I/O failure.Error::CliArg— a CLI argument validation failure (incompatible flag combinations, missing required arguments, conflicting overrides).Error::InvalidRegex— a regex pattern from the user (CLI flag, config file, or spec override) failed to compile.Error::Render— a failure rendering a Config or Spec to text (TOML / YAML / JSON), or building a machine-format report (SARIF / Checkstyle / JUnit / JSON edit).Error::LegacyMigration— a failure during legacycmake-formatconfig migration.Error::Formatter— miscellaneous higher-level formatter or CLI failure that does not fit any of the structured sub-variants above. PreferError::CliArg,Error::InvalidRegex,Error::Render, orError::LegacyMigrationwhen applicable.Error::LayoutTooWide— only produced whencrate::Config::require_valid_layoutis enabled and a formatted line exceeded the configured width. Not a bug in the formatter — a signal to the caller.
crate::error::FileParseError and
crate::error::ParseDiagnostic carry structured line/column
metadata (1-based, both) so editor integrations can point at the
offending source without re-parsing the error string.
Structs§
- Config
Error - Stable config-file parse error returned by the public library API.
- File
Parse Error - Structured config/spec deserialization failure metadata used for user-facing diagnostics.
- Parse
Diagnostic - Crate-owned parser diagnostics used by
Errorwithout exposingpestinternals in the public API. - Parse
Error - Stable parse error returned by the public library API.
- Spec
Error - Stable command-spec parse error returned by the public library API.
Enums§
- Error
- Errors that can be returned by parsing, config loading, spec loading, or formatting operations.
Traits§
- IoResult
Ext - Extension trait for ergonomic conversion of
io::Result<T>into the crate’s path-bearingResult<T>. Reads at call sites asstd::fs::read_to_string(&path).with_path(&path)?— one extra token compared to.map_err(Error::Io)?, with much better diagnostics on failure.
Type Aliases§
- Result
- Convenience alias for crate-level results.