From 1b065ab676fd0dde01d89e6cf122449adbefd7f0 Mon Sep 17 00:00:00 2001 From: Chris Olszewski Date: Wed, 3 May 2023 13:57:17 -0700 Subject: [PATCH] add underlying error to lockfile error messages --- crates/turborepo-ffi/src/lockfile.rs | 2 +- crates/turborepo-lockfiles/src/berry/mod.rs | 6 +++--- crates/turborepo-lockfiles/src/berry/resolution.rs | 2 +- crates/turborepo-lockfiles/src/error.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/turborepo-ffi/src/lockfile.rs b/crates/turborepo-ffi/src/lockfile.rs index 7864610749e08..e03abb24f83d3 100644 --- a/crates/turborepo-ffi/src/lockfile.rs +++ b/crates/turborepo-ffi/src/lockfile.rs @@ -23,7 +23,7 @@ impl From for proto::LockfilePackage { enum Error { #[error("error performing lockfile operation: {0}")] Lockfile(#[from] turborepo_lockfiles::Error), - #[error("error decoding protobuf")] + #[error("error decoding protobuf: {0}")] Protobuf(#[from] prost::DecodeError), #[error(transparent)] BerryParse(#[from] turborepo_lockfiles::BerryError), diff --git a/crates/turborepo-lockfiles/src/berry/mod.rs b/crates/turborepo-lockfiles/src/berry/mod.rs index 6d6eb5f15fc06..7a2e878221638 100644 --- a/crates/turborepo-lockfiles/src/berry/mod.rs +++ b/crates/turborepo-lockfiles/src/berry/mod.rs @@ -21,13 +21,13 @@ use super::Lockfile; #[derive(Debug, Error)] pub enum Error { - #[error("unable to parse")] + #[error("unable to parse yaml: {0}")] Parse(#[from] serde_yaml::Error), - #[error("unable to parse")] + #[error("unable to parse identifier: {0}")] Identifiers(#[from] identifiers::Error), #[error("unable to find original package in patch locator {0}")] PatchMissingOriginalLocator(Locator<'static>), - #[error("unable to parse resolutions field")] + #[error("unable to parse resolutions field: {0}")] Resolutions(#[from] resolution::Error), #[error("unable to find entry for {0}")] MissingPackageForLocator(Locator<'static>), diff --git a/crates/turborepo-lockfiles/src/berry/resolution.rs b/crates/turborepo-lockfiles/src/berry/resolution.rs index 8f6bc6638cc27..9d755747687ac 100644 --- a/crates/turborepo-lockfiles/src/berry/resolution.rs +++ b/crates/turborepo-lockfiles/src/berry/resolution.rs @@ -15,7 +15,7 @@ fn tag_regex() -> &'static Regex { #[derive(Debug, Error)] pub enum Error { - #[error("unable to parse")] + #[error("unable to parse: {0}")] // Boxed due to this enum variant being much larger than the others Pest(#[from] Box>), #[error("unexpected end of input")] diff --git a/crates/turborepo-lockfiles/src/error.rs b/crates/turborepo-lockfiles/src/error.rs index 1668371e17b75..acaa8d58ece39 100644 --- a/crates/turborepo-lockfiles/src/error.rs +++ b/crates/turborepo-lockfiles/src/error.rs @@ -8,7 +8,7 @@ pub enum Error { MissingPackage(String), #[error("Missing version from non-workspace package: '{0}'")] MissingVersion(String), - #[error("Unable to convert from json")] + #[error("Unable to convert from json: {0}")] JsonError(#[from] serde_json::Error), #[error("Turbo doesn't support npm lockfiles without a 'packages' field")] UnsupportedNpmVersion,