diff options
author | trizen <trizen@protonmail.com> | 2020-08-08 11:28:18 +0300 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-08-14 14:45:46 -0500 |
commit | b2995e86425201f0a372b3e888b1985ab67b1e7c (patch) | |
tree | 77b973b3f297451b2e4e60a2ad658ea65fd6da9c | |
parent | bf596c266d09ee08ff725edf8d75da5425d6748c (diff) | |
download | fair-viewer-b2995e86425201f0a372b3e888b1985ab67b1e7c.tar.lz fair-viewer-b2995e86425201f0a372b3e888b1985ab67b1e7c.tar.xz fair-viewer-b2995e86425201f0a372b3e888b1985ab67b1e7c.zip |
gtk: display an helpful message when the API instance fails.
Signed-off-by: Jesús <heckyel@hyperbola.info>
-rwxr-xr-x | bin/gtk-fair-viewer | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/bin/gtk-fair-viewer b/bin/gtk-fair-viewer index 9a5f545..14177fe 100755 --- a/bin/gtk-fair-viewer +++ b/bin/gtk-fair-viewer @@ -418,10 +418,10 @@ local $SIG{__DIE__} = sub { "\nThe module $module is required!\n\nTo install it, just type in terminal:\n\tsudo cpan $module\n"; } } - . "\n=>> Previous warnings:\n" . get_text($warnings_textview) + . "\n\n=>> Previous warnings:\n" . get_text($warnings_textview) ); - warn $error; + warn "$error\n"; $errors_window->show; return 1; }; @@ -2511,8 +2511,6 @@ sub display_results { die "No results...\n"; } - add_results_to_history($results) if not $from_history; - my $url = $results->{url}; #my $info = $results->{results} // {}; my $items = $results->{results} // []; @@ -2529,12 +2527,21 @@ sub display_results { $items = $items->{playlists}; } else { - warn "[!] No results...\n"; - $items = []; + die "No results...\n"; } } - hide_feeds_window(); + if (ref($items) ne 'ARRAY') { + die + "Probably " . $yv_obj->get_api_host() . " is down.\n" + . "\nTry changing the `api_host` in configuration file:\n\n" + . qq{\tapi_host => "yewtu.be",\n} + . qq{\nSee also: https://libregit.org/heckyel/fair-viewer#invidious-instances\n}; + } + + if (@$items) { + add_results_to_history($results) if not $from_history; + } #~ if (not $from_history) { |