diff --git a/Cargo.lock b/Cargo.lock index a16d6451..60ab5afd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,7 +83,7 @@ dependencies = [ "semver", "serde", "serde_json", - "thiserror 1.0.66", + "thiserror 1.0.69", ] [[package]] @@ -306,7 +306,7 @@ dependencies = [ "serde", "serde_json", "tempfile", - "thiserror 1.0.66", + "thiserror 2.0.4", "toml", "toml_edit", "uriparse", @@ -581,11 +581,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl 1.0.66", + "thiserror-impl 1.0.69", ] [[package]] @@ -599,9 +599,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index a18cbe84..5e1e1912 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ regex = "1" semver = "1" serde = { version = "1", features = ["derive"] } serde_json = "1" -thiserror = "1" +thiserror = "2" toml = "0.8" toml_edit = "0.22" uriparse = "0.6" diff --git a/src/buildpacks.rs b/src/buildpacks.rs index 5f9b78e4..07e4ddda 100644 --- a/src/buildpacks.rs +++ b/src/buildpacks.rs @@ -58,7 +58,7 @@ pub(crate) fn find_releasable_buildpacks( .map_err(|e| FindReleasableBuildpacksError(starting_dir.to_path_buf(), e)) } #[derive(Debug, thiserror::Error)] -#[error("I/O error while finding buildpacks\nPath: {}\nError: {1}", .0.display())] +#[error("I/O error while finding buildpacks\nPath: {0}\nError: {1}")] pub(crate) struct FindReleasableBuildpacksError(PathBuf, ignore::Error); pub(crate) fn read_buildpack_descriptor( @@ -70,7 +70,7 @@ pub(crate) fn read_buildpack_descriptor( } #[derive(Debug, thiserror::Error)] -#[error("Failed to read buildpack descriptor\nPath: {}\nError: {1}", .0.display())] +#[error("Failed to read buildpack descriptor\nPath: {0}\nError: {1}")] pub(crate) struct ReadBuildpackDescriptorError(PathBuf, #[source] TomlFileError); #[cfg(test)] diff --git a/src/commands/generate_changelog/errors.rs b/src/commands/generate_changelog/errors.rs index 294d4490..788ba852 100644 --- a/src/commands/generate_changelog/errors.rs +++ b/src/commands/generate_changelog/errors.rs @@ -11,9 +11,9 @@ pub(crate) enum Error { FindReleasableBuildpacks(FindReleasableBuildpacksError), #[error(transparent)] ReadBuildpackDescriptor(ReadBuildpackDescriptorError), - #[error("Could not read changelog\nPath: {}\nError: {1}", .0.display())] + #[error("Could not read changelog\nPath: {0}\nError: {1}")] ReadingChangelog(PathBuf, #[source] std::io::Error), - #[error("Could not parse changelog\nPath: {}\nError: {1}", .0.display())] + #[error("Could not parse changelog\nPath: {0}\nError: {1}")] ParsingChangelog(PathBuf, #[source] ChangelogError), #[error(transparent)] SetActionOutput(WriteActionDataError), diff --git a/src/commands/prepare_release/errors.rs b/src/commands/prepare_release/errors.rs index 19be8829..e73c30f4 100644 --- a/src/commands/prepare_release/errors.rs +++ b/src/commands/prepare_release/errors.rs @@ -24,23 +24,23 @@ pub(crate) enum Error { NotAllVersionsMatch(HashMap), #[error("No fixed version could be determined")] NoFixedVersion, - #[error("Could not read changelog\nPath: {}\nError: {1}", .0.display())] + #[error("Could not read changelog\nPath: {0}\nError: {1}")] ReadingChangelog(PathBuf, #[source] io::Error), - #[error("Could not parse changelog\nPath: {}\nError: {1}", .0.display())] + #[error("Could not parse changelog\nPath: {0}\nError: {1}")] ParsingChangelog(PathBuf, #[source] ChangelogError), - #[error("Could not write changelog\nPath: {}\nError: {1}", .0.display())] + #[error("Could not write changelog\nPath: {0}\nError: {1}")] WritingChangelog(PathBuf, #[source] io::Error), - #[error("Missing required field `{1}` in buildpack.toml\nPath: {}", .0.display())] + #[error("Missing required field `{1}` in buildpack.toml\nPath: {0}")] MissingRequiredField(PathBuf, String), - #[error("Invalid buildpack id `{1}` in buildpack.toml\nPath: {}", .0.display())] + #[error("Invalid buildpack id `{1}` in buildpack.toml\nPath: {0}")] InvalidBuildpackId(PathBuf, String), - #[error("Invalid buildpack version `{1}` in buildpack.toml\nPath: {}", .0.display())] + #[error("Invalid buildpack version `{1}` in buildpack.toml\nPath: {0}")] InvalidBuildpackVersion(PathBuf, String), - #[error("Could not read buildpack\nPath: {}\nError: {1}", .0.display())] + #[error("Could not read buildpack\nPath: {0}\nError: {1}")] ReadingBuildpack(PathBuf, #[source] io::Error), - #[error("Could not parse buildpack\nPath: {}\nError: {1}", .0.display())] + #[error("Could not parse buildpack\nPath: {0}\nError: {1}")] ParsingBuildpack(PathBuf, #[source] toml_edit::TomlError), - #[error("Could not write buildpack\nPath: {}\nError: {1}", .0.display())] + #[error("Could not write buildpack\nPath: {0}\nError: {1}")] WritingBuildpack(PathBuf, #[source] io::Error), } diff --git a/src/commands/update_builder/errors.rs b/src/commands/update_builder/errors.rs index 1d3b253a..b3f9e702 100644 --- a/src/commands/update_builder/errors.rs +++ b/src/commands/update_builder/errors.rs @@ -5,25 +5,27 @@ use std::path::PathBuf; #[derive(Debug, thiserror::Error)] pub(crate) enum Error { - #[error("Failed to resolve path {}\nError: {1}", .0.display())] + #[error("Failed to resolve path {0}\nError: {1}")] ResolvePath(PathBuf, std::io::Error), #[error(transparent)] FindReleasableBuildpacks(FindReleasableBuildpacksError), #[error(transparent)] ReadBuildpackDescriptor(ReadBuildpackDescriptorError), - #[error("No buildpacks were found in the given directory\nPath: {}", .0.display())] + #[error("No buildpacks were found in the given directory\nPath: {0}")] NoBuildpacks(PathBuf), - #[error("Could not read builder\nPath: {}\nError: {1}", .0.display())] + #[error("Could not read builder\nPath: {0}\nError: {1}")] ReadingBuilder(PathBuf, #[source] std::io::Error), - #[error("Could not parse builder\nPath: {}\nError: {1}", .0.display())] + #[error("Could not parse builder\nPath: {0}\nError: {1}")] ParsingBuilder(PathBuf, #[source] toml_edit::TomlError), - #[error("Error writing builder\nPath: {}\nError: {1}", .0.display())] + #[error("Error writing builder\nPath: {0}\nError: {1}")] WritingBuilder(PathBuf, #[source] std::io::Error), #[error("No builder.toml files found in the given builder directories\n{}", list_builders(.0))] NoBuilderFiles(Vec), - #[error("The following buildpack is missing the metadata.release.image.repository entry\nPath: {}", .0.display())] + #[error( + "The following buildpack is missing the metadata.release.image.repository entry\nPath: {0}" + )] MissingImageRepositoryMetadata(PathBuf), - #[error("Failed to calculate digest for buildpack\nPath: {}\nError: {1}", .0.display())] + #[error("Failed to calculate digest for buildpack\nPath: {0}\nError: {1}")] CalculatingDigest(PathBuf, #[source] CalculateDigestError), #[error("Missing required key `{0}` in builder")] BuilderMissingRequiredKey(String),