On Tue, Dec 01, 2015 at 02:09:21PM +0100, Josef Reidinger wrote: > On Tue, 1 Dec 2015 13:46:12 +0100 > Arvin Schnell <[email protected]> wrote:
> > No, to quote Stroustrup: "exceptions are used to signal errors > > that cannot be handled locally". Casting to a wrong type or > > requesting a non-existing object is an error that cannot be > > handled locally and thus must be signaled, e.g. by an exception. > > I fully agree with stroustrup that if you have error that cannot > be handled locally raise exception. Still I do not see how having disk > without partition table can be error if it is supported and expected > use case. Error for me is if there is partition table, but we cannot > read it, it is corrupted, etc. but not in expected scenario. Having a string with 1000 characters is supported. Still, if you have a string with only 100 characters and you request the 200st character you will cause an exception. It's the same with the device graph in libstorage. A disk can have a partition table or a filesystem (or something else) as a child. Requesting the filesystem if the child is not a filesystem raises an exception (as explained above). But this discussion is once again unfruitful. In programming it is not black and white. Those that implement something have to find one way, others would have found other ways. Regards, Arvin -- Arvin Schnell, <[email protected]> Senior Software Engineer, Research & Development SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) Maxfeldstraße 5 90409 Nürnberg Germany -- To unsubscribe, e-mail: [email protected] To contact the owner, e-mail: [email protected]
