Skip to content

Conversation

@grainme
Copy link
Contributor

@grainme grainme commented Jan 24, 2025

While using oha, I found that it panics when given a URL without a scheme (e.g., localhost:4221 instead of http://localhost:4221).

Instead of a friendly error message, we get this panic:
image

Proposed Change

I tried to make this a bit more user-friendly by:

  • Replace unwrap() with some error handling
  • Set exit code on failure

I'm new to the project, so please let me know if there's a better way to handle this.

- Replace unwrap() with some error handling
- Print user-friendly error message
- Set exit code on failure

This change makes the tool more user-friendly by providing error messages instead of panicking.
@grainme grainme changed the title fix: improve error handling in main function fix: improve error handling for URLs without scheme Jan 24, 2025
Copy link
Owner

@hatoo hatoo left a comment

Choose a reason for hiding this comment

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

Nice catch!

I added a small review.
Thank you.

@hatoo hatoo merged commit 5aaaca3 into hatoo:master Jan 25, 2025
18 checks passed
@hatoo
Copy link
Owner

hatoo commented Jan 25, 2025

👍

@Mua-th
Copy link

Mua-th commented Jan 25, 2025

nas khdama lahoma barik hhh

@grainme grainme deleted the fix-graceful-url-parsing branch January 25, 2025 19:35
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.

3 participants