Skip to contentSkip to conversation

gfxterm: check elements' properties and hadle errors.

PATCH Vladimir Testov 1 participant 1 message Mar 7, 2013

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines

Again - what problem are you trying to solve? I added unknown option to theme element and it was loaded and displayed just fine. Why aborting theme loading in this case is better?

There is possibility that we can misprint some option. Or write some wrong value for some existing option. I think it's better to know about it - so we can quickly find the place where we are wrong.

Quoted 2 lines

May be you should be less hostile to simple questions? I take it you are expert in GRUB2 themes. I'm not and I'm trying to learn. OK?

Sorry, if I've insulted you. That wasn't my intension.

Quoted 1 line

You conveniently ignored comment about losing original error.

The original error will be displayed anyway, because it's called via grub_error function. grub_errno in that case is only an indicator that everything went all right or something went wrong. Returning error state (from component's modules) doesn't change grub_errno until we call grub_error in theme_loader. In current state return value isn't analized. And I think it's not good.
(if theme_loaders checks global options and component's names - why shouldn't it also check for component's options)

I could think about more complicated hadling of return value.
If it is GRUB_ERR_IO then either information message about the error has already been shown (don't see the possibility of the fact right now)
or we've faced some non-existing option (or option with a misprint)
So I could check for other types of error and hadle them more properly.

grub_errno in that case means error code, returned after trying to set a particular value to a particular option. so if return code is GRUB_ERR_IO then there is a problem with option name
otherwise there is a problem with a value (e.g. we tried to set integer value to a option, which accepts string value.)

If you concerns are about right that - I can slightly remake the patch to show more detailed information about the error.

Cheers.

Signature · 4 lines
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru