GNOME Bugzilla – Bug 681102
calendar: "[appointements]" as parameter fails if parameter is null
Last modified: 2017-10-30 16:13:51 UTC
Created attachment 220192 [details] [review] calendar: "[appointements]" as parameter fails if parameter is null To handle the case of null passed as parameter do not use this syntactic sugar. Instead grab the array containing the array of the appointments and get its first index as the array of the appointments.
Review of attachment 220192 [details] [review]: ::: js/ui/calendar.js @@ +272,3 @@ }, + _onEventsReceived: function(appointments_array) { We should be taking an error and checking for that instead. _onEventsReceived: function(results, err) { if (params == null) { // do something with error } else { let [appointments] = results; } } @@ +275,3 @@ let newEvents = []; + if (appointments_array != null) { + appointments = appointments_array[0]; This defines a global. No.
Created attachment 220204 [details] [review] [V2] calendar: "[appointements]" as parameter fails if parameter is null
I found the way to reproduce in the process of improving the patch. One need a google calendar. Then change the "path" of the calendar to point to something non existant (add "/a" to the end). Then show the shell calendar and wait. I kind of struggled to reproduce even with those steps : seems not caching the calendar and disabling/enabling it helps. This happened to me because I had calendar long defined not managed by me and the calendar IDs changed .
Comment on attachment 220204 [details] [review] [V2] calendar: "[appointements]" as parameter fails if parameter is null $:andre\> patch --no-backup-if-mismatch -p1 < aaaapatch patching file js/ui/calendar.js Hunk #1 FAILED at 271. 1 out of 1 hunk FAILED -- saving rejects to file js/ui/calendar.js.rej Hence setting 'needs-rework' as patch does not apply cleanly against git master.
Thanks it has been handling in commit a4e29e1244b097fc2bebc371e00d7af30537c376 " calendar: Handle calendar-server errors". The only difference is in me printing the error message on remote server calendar errors.Is it of value ? Ie: if (error != null) { log("Failed to get appointments : remote error '"+error+"'"); *** This bug has been marked as a duplicate of bug 686805 ***