pub enum Error {
Io(Error),
Edit(TomlError),
Parse(Error),
Json(Error),
Jsonfive(Error),
Missing(PathBuf),
Shell(ExitStatus),
NoCommand,
Config,
Exists(PathBuf),
Utf(FromUtf8Error),
Environment(String),
}Expand description
Represents all possible errors that can occur during the build script’s execution.
This enum provides a comprehensive error type for the build orchestration system, covering all failure modes from IO operations to parsing errors to command execution failures. Each variant includes relevant context to help diagnose the issue.
The enum derives Error from the thiserror crate, which provides
automatic implementations of the Error trait and error display formatting.
§Automatic Conversions
This type implements From for several error types, allowing the ?
operator to automatically convert library-specific errors into Error:
io::Error→Error::Iotoml_edit::TomlError→Error::Edittoml::de::Error→Error::Parseserde_json::Error→Error::Jsonjson5::Error→Error::Jsonfivestd::string::FromUtf8Error→Error::Utf
Variants§
Io(Error)
IO operation error.
This variant wraps standard Rust IO errors that can occur during file operations like reading, writing, copying, or deleting files.
Edit(TomlError)
Toml editing error.
This variant wraps errors that occur when manipulating TOML documents
using the toml_edit library, such as invalid mutations or parsing
issues when reading TOML content.
Parse(Error)
Toml deserialization error.
This variant wraps errors that occur when parsing TOML files into
Rust structs using the toml library’s deserialization functionality.
Json(Error)
JSON parsing/error.
This variant wraps errors that occur when parsing or validating
standard JSON files using the serde_json library.
Jsonfive(Error)
JSON5 parsing/error.
This variant wraps errors that occur when parsing or validating
JSON5 files (a more flexible JSON format) using the json5 library.
Missing(PathBuf)
Missing directory error.
This variant is used when a required directory does not exist at the specified path. The path is included for debugging purposes,
Shell(ExitStatus)
Shell command execution failure.
This variant is used when the final build command fails to execute successfully. The exit status is included to provide information about the failure.
NoCommand
No command provided error.
This variant is used when the build script is invoked without specifying a build command to execute.
Config
Tauri configuration file not found error.
This variant is used when neither tauri.conf.json nor
tauri.conf.json5 can be found in the project directory.
Exists(PathBuf)
Backup file already exists error.
This variant is used when the Guard attempts to create a backup but a backup file already exists at the target location. This prevents overwriting existing backups and ensures data safety.
Utf(FromUtf8Error)
UTF-8 conversion error.
This variant wraps errors that occur when converting byte vectors to UTF-8 strings, particularly when dealing with file contents or command output.
Environment(String)
Missing environment variable error.
This variant is used when a required environment variable is not set. The variable name is included in the error message for easy identification and resolution.