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

fix: handle possible date field lookup exceptions #66

Closed

Conversation

gabek
Copy link

@gabek gabek commented Sep 8, 2023

This adds a simple try/catch around parsing the date lookup key to catch exceptions, and allow the script to continue.

Hopefully addresses #61. Though I'm not sure how to test a dev version of a Obsidian plugin, so I'm being naughty and pushing up untested code.

@gabek
Copy link
Author

gabek commented Oct 25, 2023

Hi there @muness! What do you think about catching these exceptions when parsing calendar items?

@muness
Copy link
Member

muness commented Oct 25, 2023

Hi @gabek , I like it but I'd prefer it if it wasn't silent, maybe a toast notification with the number of issues across number of calendars and a bit more info in the console.

@muness
Copy link
Member

muness commented Oct 26, 2023

Added error handling in #73 that includes a note to the user.

@muness muness closed this Oct 26, 2023
@muness
Copy link
Member

muness commented Oct 26, 2023

@gabek , please give 1.2.1 a try and let me know if that captures the error. Thanks! https://github.com/muness/obsidian-ics/releases/tag/1.2.1

@gabek
Copy link
Author

gabek commented Oct 26, 2023

No luck parsing, but at least it's caught and there's an error pointing to something:

plugin:ics:21 Error filtering events for calendar Personal: RangeError: Invalid time value

I'm not sure if it's helpful, but here's an example event that I randomly took from my calendar.

BEGIN:VEVENT
CREATED:20230908T184114Z
DTEND;TZID=America/Los_Angeles:20230911T210000
DTSTAMP:20230930T162519Z
DTSTART;TZID=America/Los_Angeles:20230911T190000
LAST-MODIFIED:20230930T162516Z
LOCATION:Noisebridge\n272 Capp St\, San Francisco\, CA  94110\, United Stat
 es
RRULE:FREQ=WEEKLY
SEQUENCE:1
SUMMARY:Python class
TRANSP:OPAQUE
UID:E7E45FB6-5A2B-4524-A598-613E984C1F27
X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS="272 Capp St, San Francisco
 , CA  94110, United States";X-APPLE-MAPKIT-HANDLE="CAESwgIIrk0QzseTmIHXmY+
 ZARoSCRIeI4+W4UJAEbbv9sXKml7AIogBCg1Vbml0ZWQgU3RhdGVzEgJVUxoKQ2FsaWZvcm5pY
 SICQ0EqDVNhbiBGcmFuY2lzY28yDVNhbiBGcmFuY2lzY286BTk0MTEwQhBNaXNzaW9uIERpc3R
 yaWN0UgdDYXBwIFN0WgMyNzJiCzI3MiBDYXBwIFN0igEQTWlzc2lvbiBEaXN0cmljdCoLTm9pc
 2VicmlkZ2UyCzI3MiBDYXBwIFN0MhhTYW4gRnJhbmNpc2NvLCBDQSAgOTQxMTAyDVVuaXRlZCB
 TdGF0ZXM4L1ABWkwKJQjOx5OYgdeZj5kBEhIJEh4jj5bhQkARtu/2xcqaXsAYrk2QAwGiHyIIz
 seTmIHXmY+ZARoVCgtOb2lzZWJyaWRnZRAAKgJlbkAA";X-APPLE-RADIUS=141.1748460478
 501;X-APPLE-REFERENCEFRAME=1;X-TITLE=Noisebridge:geo:37.762407\,-122.41862
 6
X-LIC-ERROR;X-LIC-ERRORTYPE=VALUE-PARSE-ERROR:No value for URL property. Re
 moving entire property:
END:VEVENT

@muness
Copy link
Member

muness commented Oct 26, 2023

DTEND;TZID=America/Los_Angeles:20230911T210000 to my eyes looks like the issue. I think the timezone is usually at the end, like DTEND;20230911T210000Z-0700

Do you have the exception stack handy? I am curious as to where this is failing: my code or something in node-ical or rrule

@gabek
Copy link
Author

gabek commented Oct 26, 2023

Sure!

image

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

Successfully merging this pull request may close these issues.

2 participants