Hi Peter, I’m currently working on that Torrent file parsing. I’m implementing it as a class from the beginning and it’s going well. Basic data parsing (announce, announce-list, created by, …) is done and working (according to my unit tests). Now I’m going to implement a storage of the rest properties from torrent files like files/directories and their attributes.
There was only one “problem” so far which I’d like to discuss here - error handling. For example if a torrent file contains invalid data or the selected file doesn’t exist, what should I do and how to inform the caller that there was a problem? Is there some standard way how we should do this in Calitko - maybe exceptions handling? Currently I’m doing this way: I have implemented member function valid() that returns true if the torrent is in a valid state (e.g. everything went ok during file parsing) and false otherwise. So for example if a torrent file contains invalid data and cannot be parsed there is a private flag which I set and caller can easily find out whether everything is ok. It’s working good but there is one flaw - caller cannot determine the reason why the parsing went wrong. So maybe I could implement a new member function which can do this, but I don’t know whether it is a good way or not…
I would be grateful for any ideas.
Thanks, Petr
