Skip to content

useless error message if timezone is unknown #174

@htgoebel

Description

@htgoebel

When parsing a vevent using a custom time zone (see #173), error messages like this, which - sorry to say - are no use:

ERROR:root:'(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna'

Expected result

In the error message I'd like to learn

  • what is the error - what is wrong
  • in which file
  • if the file contains several item: which entry is the bogus one

I tracked this message down to https://github.com/eventable/vobject/blob/0.9.6.1/vobject/icalendar.py#L83. At this point there is no chance to know the file or the item, not even the item-element. Anyhow, the message should at least read

ERROR:root:Unknown Timezone: '(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna'

How to reproduce

import vobject

# for reproducing of thus bug, this stipped down vevent is enough
VEVENT = """
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
UID:1-2-3-4
DTSTART;TZID="(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"
 :20200504T110000
DTEND;TZID="(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna":2
 0200504T113000
DTSTAMP:20200303T123456Z
SUMMARY:Some Appointment
END:VEVENT
END:VCALENDAR
"""

obj = tuple(vobject.readComponents(VEVENT))[0]
obj.prettyPrint()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions