Merge lp:~rainct/zeitgeist/delete-events-empty-array-exception into lp:~zeitgeist/zeitgeist/bluebird
Status: | Needs review |
---|---|
Proposed branch: | lp:~rainct/zeitgeist/delete-events-empty-array-exception |
Merge into: | lp:~zeitgeist/zeitgeist/bluebird |
Diff against target: |
17 lines (+6/-1) 1 file modified
src/engine.vala (+6/-1) |
To merge this branch: | bzr merge lp:~rainct/zeitgeist/delete-events-empty-array-exception |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zeitgeist Framework Team | Pending | ||
Review via email:
|
Description of the change
DeleteEvents currently requires a non-empty event_ids list, but this is checked with an assert, which is kinda ugly. I see two options here:
1. Promote the assert to a proper INVALID_ARGUMENT exception.
2. Instead decide to handle empty lists by just doing nothing and returning TimeRange(0, 0).
This branch implements the 1st behaviour. I don't really like the second option since:
a) Returning (0,0) -or any other duplicate value- seems rather arbitrary, and it's a special case they'll have to check for if they want to use either early_timestamp or late_timestamp individualy. From the Zen of Python: «Special cases aren't special enough to break the rules» :).
b) It's trivial for applications to check what they are doing before wasting D-Bus and Zeitgeist's time.
Unmerged revisions
- 468. By Siegfried Gevatter
-
DeleteEvents: promote assert to exception