On Tue, 1 Dec 2015 13:46:12 +0100
Arvin Schnell
On Tue, Dec 01, 2015 at 09:21:26AM +0100, Ladislav Slezak wrote:
Dne 24.11.2015 v 16:45 Josef Reidinger napsal(a):
On Tue, 24 Nov 2015 15:47:24 +0100 Stefan Hundhammer
wrote: [...] I have to do different things. To stay with the current example: A disk might have
- an old-style MS-DOS type partition table with 4 slots (where I need to use an extended partition if I need any more partitions)
- a new style GPT partition table that can have any number of parititions
- a filesystem directly on the disk device without any partition table
So for me I can see it as three types of partition table - msdos, gpt and no. I do not see why is better to have
begin if gpt? elsif msdos? end rescue # no partition table case end
If no partition is a valid use case (and it is as mentioned above) then it does not make sense to raise exception in that case. Exceptions should be used only in error cases to handle *unexpected* things...
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. Josef
Regards, Arvin
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org