Skip to content

bug: Error Message is Partially Helpful #6123

@phreed

Description

@phreed

Describe the bug

https://github.com/apache/opendal/blob/v0.53.1/core/src/raw/http_util/client.rs#L164-L169

let mut req_builder = self
      .request(
          parts.method,
          reqwest::Url::from_str(&uri.to_string()).expect("input request url must be valid"),
      )
      .headers(parts.headers);

The expect message produced here is not ideal.
Here is an example of its presentation.
"input request url must be valid: InvalidIpv4Address"
(see prefix-dev/rattler-build#1595 (comment))

It would be helpful if the message contained the defective url.
Maybe something like the following:

reqwest::Url::from_str(&uri.to_string()).expect(&format!("input request url must be valid {}", uri)),

Steps to Reproduce

Provide a defective uri and observe that the defective uri is not presented.

Expected Behavior

I expect to have enough information to identify why the uri is defective.

Additional Context

This problem appeared in rattler-build, which uses this library.
prefix-dev/rattler-build#1595

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions