Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error messages for buildpack packaging failures #720

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Nov 6, 2023

After #666, incorrect error messages are shown for failures that occur during buildpack compilation packaging, since the handling in TestRunner::build_internal uses the wrong message text, plus doesn't include the error struct in the panic! string.

These have been fixed, plus display representations added to all of the new error variants.

In addition, the usages of assert! and .unwrap() in functions that return Result have been replaced with new error enum variants.

The change in output can be seen in the new tests added by #717.

There is one last scenario that doesn't yet have a test - the testing of the cross-compilation output itself. However, I'll add that separately, since it's going to be more complex to test / there are a few different options that we'll need to choose between.

Fixes #704.
Fixes #709.
Fixes #710.
GUS-W-14395170.

@edmorley edmorley added bug Something isn't working libcnb-test labels Nov 6, 2023
@edmorley edmorley self-assigned this Nov 6, 2023
After #666, incorrect error messages were shown for failures that
occurred during buildpack compilation packaging, since the
handling in `TestRunner::build_internal` used the wrong message
text, plus didn't include the error struct in the `panic!` string.

These have been fixed, plus display representations added to
all of the new error variants.

In addition, the usages of `assert!` and `.unwrap()` in functions that
return `Result` have been replaced with new error enum variants.

The change in output can be seen in the new tests added by #717.

There is one last scenario that doesn't yet have a test - the testing
of the cross-compilation output itself. However, I'll add that separately,
since it's going to be more complex to test / there are a few different
options that we'll need to choose between.

Fixes #704.
Fixes #709.
Fixes #710.
GUS-W-14395170.
@edmorley edmorley force-pushed the edmorley/fix-libcnb-test-error-handling branch from 693e2e9 to 9504a2c Compare November 6, 2023 17:27
@edmorley edmorley marked this pull request as ready for review November 6, 2023 17:37
@edmorley edmorley requested a review from a team as a code owner November 6, 2023 17:37
libcnb-test/src/build.rs Outdated Show resolved Hide resolved
@edmorley edmorley merged commit 5ab4b03 into main Nov 7, 2023
4 checks passed
@edmorley edmorley deleted the edmorley/fix-libcnb-test-error-handling branch November 7, 2023 12:52
edmorley added a commit that referenced this pull request Nov 7, 2023
* Use contractions per Simplified Technical English guidelines
  (e.g. "Couldn't" instead of "Could not").
* Prefer using past tense for potentially transient failures
  (e.g. "Couldn't read buildpack.toml" rather than "Can't").
* Prefer using actual filenames rather than their spec names
  (e.g. "Couldn't read buildpack.toml" rather than
  "Couldn't read buildpack descriptor").
* Use "I/O error" instead of "IO error" or "IOError"
* Use display representations when including underlying error
  messages in the current error message where possible (ie: For
  most errors apart from `io::Error`). This also means preferring
  `panic!` over `.expect()`, since the latter uses the debug
  representation instead of display.
* Use "Error ..." as the prefix for all top level error message
  (i.e. at the `panic!` or `.expect()` call sites).
* Use `#[error(transparent)]` instead of `#[error("{0}")]` per:
  #720 (comment)

GUS-W-14445374.
edmorley added a commit that referenced this pull request Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libcnb-test
Projects
None yet
3 participants