]> git.sesse.net Git - skvidarsync/commitdiff
Be more robust towards Sheets API errors; for instance, if the sheet does not exist.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 27 Nov 2023 20:43:37 +0000 (21:43 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 27 Nov 2023 20:43:37 +0000 (21:43 +0100)
bin/sync.pl

index b12125b1a295e2b733929844bec4bd7878f091ba..2d315c9d2a646f7448d82b03db5f65b946f02ff4 100644 (file)
@@ -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];