From: Steinar H. Gunderson Date: Mon, 27 Nov 2023 20:43:37 +0000 (+0100) Subject: Be more robust towards Sheets API errors; for instance, if the sheet does not exist. X-Git-Url: https://git.sesse.net/?p=skvidarsync;a=commitdiff_plain;h=13d39f0996506ad9c452a0a4e39784ebaaa03bd9 Be more robust towards Sheets API errors; for instance, if the sheet does not exist. --- diff --git a/bin/sync.pl b/bin/sync.pl index b12125b..2d315c9 100644 --- a/bin/sync.pl +++ b/bin/sync.pl @@ -579,6 +579,9 @@ sub run { log_timing($start, "/spreadsheets/"); my $sheets_json = JSON::XS::decode_json($response->decoded_content); + if (!exists($sheets_json->{'sheets'})) { + die "Missing sheets (error response?): " . $response->decoded_content; + } my $main_sheet_json = $sheets_json->{'sheets'}[0]; my $mapping_sheet_json = $sheets_json->{'sheets'}[1];