Mailinglist Archive: yast-devel (50 mails)

< Previous Next >
Re: [yast-devel] New libstorage: Returning NULL pointers vs. throwing exceptions
Dne 24.11.2015 v 16:45 Josef Reidinger napsal(a):
On Tue, 24 Nov 2015 15:47:24 +0100
Stefan Hundhammer <shundhammer@xxxxxxx> 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...

then simple

if gpt?
elsif msdos?
elsif no?
end

+1, this looks better to me...


--

Ladislav Slezák
Appliance department / YaST Developer
Lihovarská 1060/12
190 00 Prague 9 / Czech Republic
tel: +420 284 028 960
lslezak@xxxxxxxx
SUSE
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups