bjesus / wttrbar

Custom module for showing the weather in Waybar, using the great wttr.in
MIT License
164 stars 26 forks source link

Bug: thread 'main' panicked at src/main.rs:61:64 #55

Closed graves501 closed 5 months ago

graves501 commented 5 months ago

Hi, I just installed wttrbar via AUR: aur/wttrbar 0.10.1-1.

However, when running wttrbar without parameters and with the example parameters provided, I get an error message:

$ RUST_BACKTRACE=full wttrbar --date-format "%m/%d" --location Paris --hide-conditions
thread 'main' panicked at src/main.rs:61:64:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Decode, source: Error("expected value", line: 1, column: 1) }
stack backtrace:
   0:     0x58c5e08d9495 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h01ae9338a6ae91eb
   1:     0x58c5e09007e3 - core::fmt::write::h491257998796a622
   2:     0x58c5e08d68ff - std::io::Write::write_fmt::hb2c64deac04aca6a
   3:     0x58c5e08d92a0 - std::sys_common::backtrace::print::h06f8cce91d6289fa
   4:     0x58c5e08da915 - std::panicking::default_hook::{{closure}}::hcd1fdb5834ba5bf8
   5:     0x58c5e08da693 - std::panicking::default_hook::h40cebc24e84e383d
   6:     0x58c5e08dada8 - std::panicking::rust_panic_with_hook::h619a773c3e95c6fc
   7:     0x58c5e08dac86 - std::panicking::begin_panic_handler::{{closure}}::h991678da18466d9f
   8:     0x58c5e08d9989 - std::sys_common::backtrace::__rust_end_short_backtrace::h88c53d196138c39d
   9:     0x58c5e08da9d7 - rust_begin_unwind
  10:     0x58c5e063f826 - core::panicking::panic_fmt::h63d411b0acff0bd2
  11:     0x58c5e063fcd6 - core::result::unwrap_failed::hd26e04125959b951
  12:     0x58c5e0643b0e - wttrbar::main::he8b6c9446964fc47
  13:     0x58c5e065e9f6 - std::sys_common::backtrace::__rust_begin_short_backtrace::hc62a5a693acffca3
  14:     0x58c5e065d34c - std::rt::lang_start::{{closure}}::he45106e15e501cc6
  15:     0x58c5e08d11ee - std::rt::lang_start_internal::h89fc545bf879bd54
  16:     0x58c5e06444a4 - main
  17:     0x72a38e079c88 - <unknown>
  18:     0x72a38e079d4c - __libc_start_main
  19:     0x58c5e063fe75 - _start
graves501 commented 5 months ago

Ugh, seems like wttr.in itself is the culprit:

Sorry, we are running out of queries to the weather service at the moment.
Here is the weather report for the default city (just to show you what it looks like).
We will get new queries as soon as possible.
You can follow https://twitter.com/igor_chubin for the updates.
======================================================================================

Maybe wttrbar should print out a more meaningful message when the API doesn't respond?

bjesus commented 5 months ago

I think that wttr.in should at least format its error messages as a JSON. I don't see a reason to invest in making wttrbar bulletproof against whatever kind of data it might receive in case of a third-party error.