Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue processing after calendar.events.insert errors #282

Open
afentoe opened this issue Aug 14, 2022 · 3 comments
Open

Continue processing after calendar.events.insert errors #282

afentoe opened this issue Aug 14, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@afentoe
Copy link

afentoe commented Aug 14, 2022

Would it be possible, after logging the error, to continue processing the next events and other calendars?

I have a certain event, which causes this error:

Adding new event "some-uid"

GoogleJsonResponseException: API call to calendar.events.insert failed with error: The specified time range is empty.
at unknown function
at callWithBackoff(Helpers:877:16)
at processEvent(Helpers:227:20)
at unknown function
at startSync(Code:203:15)

After this error, the scripts stops and does not continue.

So this is not about fixing the error which caused the exception, but better exception handing and continue processing.

FYI: The error was caused by importing an event with a DTEND which is before the DTSTART.

BEGIN:VEVENT
DTSTART:20220829T150000
DTEND:20220829T110000
LAST-MODIFIED:20220730T213041
UID:[email protected]
END:VEVENT

@afentoe afentoe added the enhancement New feature or request label Aug 14, 2022
@mrtoner
Copy link

mrtoner commented Sep 17, 2022

+1
Same request for enhancement: I had the script fail because of an "A provided value exceeds the allowed size limit" error. I found and fixed the affected events, but would like to see the script simply log and continue.

@derekantrican derekantrican changed the title Continue processing after GoogleJsonResponseException: API call to calendar.events.insert failed with error Continue processing after GoogleJsonResponseException: API call to calendar.events.insert failed with error "The specified time range is empty" Mar 21, 2023
@derekantrican derekantrican changed the title Continue processing after GoogleJsonResponseException: API call to calendar.events.insert failed with error "The specified time range is empty" Continue processing after calendar.events.insert errors Mar 21, 2023
@rupumped
Copy link
Contributor

rupumped commented Mar 30, 2023

In Helpers.gs, on line 939, could we replace throw err; with return null;? That way, when it encounters an error in an event, it will skip the event and move on.

@aapjeisbaas
Copy link

This fixes some of my issue with partial broken external ics feeds, it just carries on and imports what it can import
Only I added a log to be able to see that events are broken:

    catch(err){
      err = err.message  || err;
      if ( err.includes("HTTP error") ) {
        Logger.log(err);
        return null;
      } else if ( err.includes("is not a function")  || !backoffRecoverableErrors.some(function(e){
              return err.toLowerCase().includes(e);
            }) ) {
        //throw err; // disable to carry on after an error
        Logger.log( "Error [" + err  +"]");
        return null;
      } else if ( tries > maxRetries) {
        Logger.log(`Error, giving up after trying ${maxRetries} times [${err}]`);
        return null;
        ```
        

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants