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: Improve protoc not found error message #937

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

allan2
Copy link
Contributor

@allan2 allan2 commented Oct 28, 2023

  • fixes missing whitespace between the error message and the OS-specific hint
  • more succinct wording in error message
  • capitalization ("debian" -> "Debian")
  • consistent grammar tenses, slightly more formal and direct tone
  • os_specific_hint now has hard breaks at 80 chars (just like error_msg)

Before:

 --- stderr
  thread 'main' panicked at /home/allan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prost-build-0.12.1/src/lib.rs:1475:10:
  Could not find `protoc` installation and this build crate cannot proceed without
      this knowledge. If `protoc` is installed and this crate had trouble finding
      it, you can set the `PROTOC` environment variable with the specific path to your
      installed `protoc` binary.If you're on debian, try `apt-get install protobuf-compiler` or download it from https://github.com/protocolbuffers/protobuf/releases

  For more information: https://docs.rs/prost-build/#sourcing-protoc

Proposed:

 --- stderr
  thread 'main' panicked at tests/single-include/build.rs:7:10:
  called `Result::unwrap()` on an `Err` value: Custom { kind: NotFound, error: "Could not find `protoc`. If `protoc` is installed, try setting the `PROTOC` environment variable to the path of the `protoc` binary. To install it on Debian, run `apt-get install protobuf-compiler`. It is also available at https://github.com/protocolbuffers/protobuf/releases  For more information: https://docs.rs/prost-build/#sourcing-protoc" }

One difference is that the previous message has a hanging indent, but this PR removes it. I would be happy to add it back.

Copy link
Collaborator

@caspermeijn caspermeijn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase to latest master to fix CI

@caspermeijn
Copy link
Collaborator

Please rebase to latest master to fix CI

I see you rebase, but I just merged another PR related to protoc not found. Can you rebase again? Thanks

@allan2
Copy link
Contributor Author

allan2 commented Mar 8, 2024

Rebased on top of latest.

- fixes missing whitespace between the error message and the OS-specific hint
- more succinct wording in error message
- capitalization ("debian" -> "Debian")
- consistent grammar tenses, slightly more formal and direct tone
- `os_specific_hint` now has hard breaks at 80 chars (just like `error_msg`)

Before:
```
 --- stderr
  thread 'main' panicked at /home/allan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prost-build-0.12.1/src/lib.rs:1475:10:
  Could not find `protoc` installation and this build crate cannot proceed without
      this knowledge. If `protoc` is installed and this crate had trouble finding
      it, you can set the `PROTOC` environment variable with the specific path to your
      installed `protoc` binary.If you're on debian, try `apt-get install protobuf-compiler` or download it from https://github.com/protocolbuffers/protobuf/releases

  For more information: https://docs.rs/prost-build/#sourcing-protoc
  ```

Proposed:
```
 --- stderr
  thread 'main' panicked at tests/single-include/build.rs:7:10:
  called `Result::unwrap()` on an `Err` value: Custom { kind: NotFound, error: "Could not find `protoc`. If `protoc` is installed, try setting the `PROTOC` environment variable to the path of the `protoc` binary. To install it on Debian, run `apt-get install protobuf-compiler`. It is also available at https://github.com/protocolbuffers/protobuf/releases  For more information: https://docs.rs/prost-build/#sourcing-protoc" }
```
Copy link
Collaborator

@caspermeijn caspermeijn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced the new lines by spaces. Due to how unwrap works, the new lines are not displayed anymore

@caspermeijn caspermeijn changed the title Improve protoc not found error message fix: Improve protoc not found error message Mar 15, 2024
@caspermeijn
Copy link
Collaborator

Thank you for your contribution

@caspermeijn caspermeijn added this pull request to the merge queue Mar 15, 2024
Merged via the queue into tokio-rs:master with commit e3d708c Mar 15, 2024
12 checks passed
caspermeijn added a commit to caspermeijn/prost that referenced this pull request Apr 2, 2024
_PROST!_ is a [Protocol Buffers](https://developers.google.com/protocol-buffers/) implementation for the [Rust Language](https://www.rust-lang.org/). `prost` generates simple, idiomatic Rust code from `proto2` and `proto3` files.

This patch updates brings a few new features and fixes:

- Bump MSRV to 1.70 (minimum supported Rust version)
- Rename cargo feature `prost-derive` to `derive` (tokio-rs#992)
- Add @generated comment on top of generated files (tokio-rs#935)
- Optimize implementation of prost::Name when generated by prost-build (tokio-rs#956)

## Dependencies
- build(deps): Allow itertools 0.12 (tokio-rs#948)
- build(deps): Allow heck 0.5 (tokio-rs#1012)
- build(deps): Allow multimap 0.10 (tokio-rs#1013)

## Documentation
- Improve protoc not found error message (tokio-rs#937)
- build: Add development container config (tokio-rs#949)
- docs: Fixed README typos (tokio-rs#952 / tokio-rs#967 / tokio-rs#970)

## Internal
- chore: Fix minimal versions (tokio-rs#920)
- fix: fq_message_name should begin with one dot (tokio-rs#981)
- improve encode_varint performance by bounding its loop (tokio-rs#940)
- style: Remove duplicate function call (tokio-rs#989)
- test: Improve test decode_varint_slow (tokio-rs#977)
- chore: Add dep: prefix to feature dependencies (tokio-rs#919)
- Minor clippy lint fixes. (tokio-rs#1006)
- chore: Use taiki-e/install-action to setup cargo-machete (tokio-rs#909)
- chore: Remove which dependency. (tokio-rs#962)
- chore: Update to actions/checkout@v4 (tokio-rs#910)

```
$ cargo semver-checks --workspace
     Parsing prost v0.12.4 (current)
      Parsed [   4.348s] (current)
     Parsing prost v0.12.3 (baseline, cached)
      Parsed [   0.099s] (baseline)
    Checking prost v0.12.3 -> v0.12.4 (minor change)
     Checked [   0.029s] 61 checks; 61 passed, 6 unnecessary
    Finished [   4.481s] prost
     Parsing prost-build v0.12.4 (current)
      Parsed [   5.488s] (current)
     Parsing prost-build v0.12.3 (baseline)
      Parsed [   3.819s] (baseline)
    Checking prost-build v0.12.3 -> v0.12.4 (minor change)
     Checked [   0.005s] 61 checks; 61 passed, 6 unnecessary
    Finished [   9.319s] prost-build
     Parsing prost-types v0.12.4 (current)
      Parsed [   3.150s] (current)
     Parsing prost-types v0.12.3 (baseline)
      Parsed [   3.192s] (baseline)
    Checking prost-types v0.12.3 -> v0.12.4 (minor change)
     Checked [   0.075s] 61 checks; 61 passed, 6 unnecessary
    Finished [   6.434s] prost-types
```
caspermeijn added a commit to caspermeijn/prost that referenced this pull request Apr 5, 2024
_PROST!_ is a [Protocol Buffers](https://developers.google.com/protocol-buffers/) implementation for the [Rust Language](https://www.rust-lang.org/). `prost` generates simple, idiomatic Rust code from `proto2` and `proto3` files.

This patch update brings new features and fixes:

- Bump MSRV to 1.70 (minimum supported Rust version)
- Rename cargo feature `prost-derive` to `derive` (tokio-rs#992)
- Add @generated comment on top of generated files (tokio-rs#935)
- Optimize implementation of prost::Name when generated by prost-build (tokio-rs#956)

## Dependencies
- build(deps): Allow itertools 0.12 (tokio-rs#948)
- build(deps): Allow heck 0.5 (tokio-rs#1012)
- build(deps): Allow multimap 0.10 (tokio-rs#1013)

## Documentation
- Improve protoc not found error message (tokio-rs#937)
- build: Add development container config (tokio-rs#949)
- docs: Fixed README typos (tokio-rs#952 / tokio-rs#967 / tokio-rs#970)

## Internal
- chore: Fix minimal versions (tokio-rs#920)
- fix: fq_message_name should begin with one dot (tokio-rs#981)
- improve encode_varint performance by bounding its loop (tokio-rs#940)
- style: Remove duplicate function call (tokio-rs#989)
- test: Improve test decode_varint_slow (tokio-rs#977)
- chore: Add dep: prefix to feature dependencies (tokio-rs#919)
- Minor clippy lint fixes. (tokio-rs#1006)
- chore: Use taiki-e/install-action to setup cargo-machete (tokio-rs#909)
- chore: Remove which dependency. (tokio-rs#962)
- chore: Update to actions/checkout@v4 (tokio-rs#910)
caspermeijn added a commit to caspermeijn/prost that referenced this pull request Apr 5, 2024
_PROST!_ is a [Protocol Buffers](https://developers.google.com/protocol-buffers/) implementation for the [Rust Language](https://www.rust-lang.org/). `prost` generates simple, idiomatic Rust code from `proto2` and `proto3` files.

This patch update brings new features and fixes:

- Bump MSRV to 1.70 (minimum supported Rust version)
- Rename cargo feature `prost-derive` to `derive` (tokio-rs#992)
- Add @generated comment on top of generated files (tokio-rs#935)
- Optimize implementation of prost::Name when generated by prost-build (tokio-rs#956)

## Dependencies
- build(deps): Allow itertools 0.12 (tokio-rs#948)
- build(deps): Allow heck 0.5 (tokio-rs#1012)
- build(deps): Allow multimap 0.10 (tokio-rs#1013)

## Documentation
- Improve protoc not found error message (tokio-rs#937)
- build: Add development container config (tokio-rs#949)
- docs: Fixed README typos (tokio-rs#952 / tokio-rs#967 / tokio-rs#970)

## Internal
- chore: Fix minimal versions (tokio-rs#920)
- fix: fq_message_name should begin with one dot (tokio-rs#981)
- improve encode_varint performance by bounding its loop (tokio-rs#940)
- style: Remove duplicate function call (tokio-rs#989)
- test: Improve test decode_varint_slow (tokio-rs#977)
- chore: Add dep: prefix to feature dependencies (tokio-rs#919)
- Minor clippy lint fixes. (tokio-rs#1006)
- chore: Use taiki-e/install-action to setup cargo-machete (tokio-rs#909)
- chore: Remove which dependency. (tokio-rs#962)
- chore: Update to actions/checkout@v4 (tokio-rs#910)
github-merge-queue bot pushed a commit that referenced this pull request Apr 5, 2024
_PROST!_ is a [Protocol Buffers](https://developers.google.com/protocol-buffers/) implementation for the [Rust Language](https://www.rust-lang.org/). `prost` generates simple, idiomatic Rust code from `proto2` and `proto3` files.

This patch update brings new features and fixes:

- Bump MSRV to 1.70 (minimum supported Rust version)
- Rename cargo feature `prost-derive` to `derive` (#992)
- Add @generated comment on top of generated files (#935)
- Optimize implementation of prost::Name when generated by prost-build (#956)

## Dependencies
- build(deps): Allow itertools 0.12 (#948)
- build(deps): Allow heck 0.5 (#1012)
- build(deps): Allow multimap 0.10 (#1013)

## Documentation
- Improve protoc not found error message (#937)
- build: Add development container config (#949)
- docs: Fixed README typos (#952 / #967 / #970)

## Internal
- chore: Fix minimal versions (#920)
- fix: fq_message_name should begin with one dot (#981)
- improve encode_varint performance by bounding its loop (#940)
- style: Remove duplicate function call (#989)
- test: Improve test decode_varint_slow (#977)
- chore: Add dep: prefix to feature dependencies (#919)
- Minor clippy lint fixes. (#1006)
- chore: Use taiki-e/install-action to setup cargo-machete (#909)
- chore: Remove which dependency. (#962)
- chore: Update to actions/checkout@v4 (#910)
gibbz00 pushed a commit to gibbz00/prost that referenced this pull request Apr 6, 2024
_PROST!_ is a [Protocol Buffers](https://developers.google.com/protocol-buffers/) implementation for the [Rust Language](https://www.rust-lang.org/). `prost` generates simple, idiomatic Rust code from `proto2` and `proto3` files.

This patch update brings new features and fixes:

- Bump MSRV to 1.70 (minimum supported Rust version)
- Rename cargo feature `prost-derive` to `derive` (tokio-rs#992)
- Add @generated comment on top of generated files (tokio-rs#935)
- Optimize implementation of prost::Name when generated by prost-build (tokio-rs#956)

## Dependencies
- build(deps): Allow itertools 0.12 (tokio-rs#948)
- build(deps): Allow heck 0.5 (tokio-rs#1012)
- build(deps): Allow multimap 0.10 (tokio-rs#1013)

## Documentation
- Improve protoc not found error message (tokio-rs#937)
- build: Add development container config (tokio-rs#949)
- docs: Fixed README typos (tokio-rs#952 / tokio-rs#967 / tokio-rs#970)

## Internal
- chore: Fix minimal versions (tokio-rs#920)
- fix: fq_message_name should begin with one dot (tokio-rs#981)
- improve encode_varint performance by bounding its loop (tokio-rs#940)
- style: Remove duplicate function call (tokio-rs#989)
- test: Improve test decode_varint_slow (tokio-rs#977)
- chore: Add dep: prefix to feature dependencies (tokio-rs#919)
- Minor clippy lint fixes. (tokio-rs#1006)
- chore: Use taiki-e/install-action to setup cargo-machete (tokio-rs#909)
- chore: Remove which dependency. (tokio-rs#962)
- chore: Update to actions/checkout@v4 (tokio-rs#910)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants