Skip to content

Commit f175c91

Browse files
authored
Error cleanup (#1080)
* Error cleanup Found a couple of mistakes in the error messages that needed to be corrected.
1 parent a078c1e commit f175c91

6 files changed

+11
-9
lines changed

Diff for: buildpacks/nodejs-npm-engine/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn on_npm_install_error(error: NpmInstallError) -> ErrorMessage {
114114

115115
NpmInstallError::OpenTarball(path, e) => error_message()
116116
.error_type(UserFacing(SuggestRetryBuild::Yes, SuggestSubmitIssue::Yes))
117-
.header(format!("Failed to opening the downloaded {npm} package file"))
117+
.header(format!("Failed to open the downloaded {npm} package file"))
118118
.body(formatdoc! {"
119119
An unexpected I/O occurred while opening the downloaded {npm} package file at {path}.
120120
", path = file_value(path) })
@@ -125,7 +125,7 @@ fn on_npm_install_error(error: NpmInstallError) -> ErrorMessage {
125125
.error_type(UserFacing(SuggestRetryBuild::Yes, SuggestSubmitIssue::Yes))
126126
.header(format!("Failed to extract {npm} package file"))
127127
.body(formatdoc! {"
128-
An unexpected I/O occurred while extracing the contents of the downloaded {npm} package file at {path}.
128+
An unexpected I/O occurred while extracting the contents of the downloaded {npm} package file at {path}.
129129
", path = file_value(path) })
130130
.debug_info(e.to_string())
131131
.create(),

Diff for: buildpacks/nodejs-npm-engine/src/snapshots/errors___npm_engine_npm_install_decompress_tarball_error.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source: buildpacks/nodejs-npm-engine/src/errors.rs
66

77
! Failed to extract `npm` package file
88
!
9-
! An unexpected I/O occurred while extracing the contents of the downloaded `npm` package file at `/layers/npm/install/npm.tgz`.
9+
! An unexpected I/O occurred while extracting the contents of the downloaded `npm` package file at `/layers/npm/install/npm.tgz`.
1010
!
1111
! Use the debug information above to troubleshoot and retry your build.
1212
!

Diff for: buildpacks/nodejs-npm-engine/src/snapshots/errors___npm_engine_npm_install_open_tarball_error.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source: buildpacks/nodejs-npm-engine/src/errors.rs
44
- Debug Info:
55
- Invalid permissions
66

7-
! Failed to opening the downloaded `npm` package file
7+
! Failed to open the downloaded `npm` package file
88
!
99
! An unexpected I/O occurred while opening the downloaded `npm` package file at `/layers/npm/install/npm.tgz`.
1010
!

Diff for: buildpacks/nodejs-npm-install/src/errors.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ fn on_buildpack_error(error: NpmInstallBuildpackError) -> ErrorMessage {
4949
fn on_node_build_scripts_metadata_error(error: NodeBuildScriptsMetadataError) -> ErrorMessage {
5050
let NodeBuildScriptsMetadataError::InvalidEnabledValue(value) = error;
5151
let value_type = value.type_str();
52+
let requires_metadata = style::value("[requires.metadata]");
53+
let buildplan_name = style::value(NODE_BUILD_SCRIPTS_BUILD_PLAN_NAME);
5254
error_message()
5355
.error_type(ErrorType::UserFacing(
5456
SuggestRetryBuild::No,
5557
SuggestSubmitIssue::Yes,
5658
))
57-
.header("Invalid build script metadata")
59+
.header("Invalid build plan metadata")
5860
.body(formatdoc! { "
59-
A participating buildpack has set invalid `[requires.metadata]` for the build plan \
60-
named `{NODE_BUILD_SCRIPTS_BUILD_PLAN_NAME}`.
61+
A participating buildpack has set invalid {requires_metadata} for the build plan \
62+
named {buildplan_name}.
6163
6264
Expected metadata format:
6365
[requires.metadata]

Diff for: buildpacks/nodejs-npm-install/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl Buildpack for NpmInstallBuildpack {
112112

113113
fn on_error(&self, error: libcnb::Error<Self::Error>) {
114114
let error_message = errors::on_error(error);
115-
eprintln!("{error_message}");
115+
eprintln!("\n{error_message}");
116116
}
117117
}
118118

Diff for: buildpacks/nodejs-npm-install/src/snapshots/errors___npm_install_node_build_scripts_metadata_error.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: buildpacks/nodejs-npm-install/src/errors.rs
33
---
4-
! Invalid build script metadata
4+
! Invalid build plan metadata
55
!
66
! A participating buildpack has set invalid `[requires.metadata]` for the build plan named `node_build_scripts`.
77
!

0 commit comments

Comments
 (0)