Wedge

Public area => The Pub => Bug reports => Topic started by: Arantor on February 29th, 2012, 02:57 AM

Title: Possible incorrect behaviour in fatal error handling?
Post by: Arantor on February 29th, 2012, 02:57 AM
OK, so I'm fixing up the calendar at last, and there's the grisly assortment of mismatches of variables and things out of scope where they were before in the original code and I forgot to preserve it.

But, interestingly, I got this to happen.

The top template, as you might recognise, is the fatal error template. The theory is that it should normally override everything and anything. But it's called with a simple wetem::load, and as it happens in this case, another wetem::load has already been issued before we get to the actual fatal_lang_error call.

I'm inclined to think that the fatal error should override and remove anything in the default layer rather than the current prepending behaviour.

Thoughts (Nao especially)?
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: live627 on February 29th, 2012, 05:20 AM
I got that behavior as well when working on my post-related plugin.
Posted: February 29th, 2012, 05:16 AM

(Topic  #1,000!)
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Nao on February 29th, 2012, 08:20 AM
Is it anything mote than a cosmetic issue?
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Arantor on February 29th, 2012, 08:57 AM
If stuff is written properly, no, because it's just a template being executed and other execution is appropriately suspended. However, if that template relies on content being set up that it would otherwise expect and now isn't, then it'll dump other errors into the log.

Now, of course, in an ideal world we wouldn't normally call wetem::load before having validated everything so that we wouldn't need to worry about it but there are times it's going to happen, with the above as a consequence.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Nao on February 29th, 2012, 09:47 AM
The error system has its errors itself.

For instance a template error (index?) will sometimes regenerate the full page inside of itself. I always smile when it happens. No biggie though. I don't know about the problem you mention though.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Arantor on February 29th, 2012, 10:12 AM
Quote
For instance a template error (index?) will sometimes regenerate the full page inside of itself. I always smile when it happens. No biggie though
I'd noticed that, heh.

The main fix, primarily, though would be to simply have the fatal error handler dropping everything inside default and only using its own template. Would likely fix the other mentioned issue too.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Nao on February 29th, 2012, 12:04 PM
You meant resetting the skeleton to just <default><error-template /></default>...? Hmm... I don't know. It can certainly be tried.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Arantor on February 29th, 2012, 12:06 PM
Well, not the entire skeleton (though that would certainly work), just replacing the entirety of <default> with that.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Nao on February 29th, 2012, 12:08 PM
In your particular case, that would fix it. In my case (the matryoshkas), I strongly suspect that wouldn't.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Arantor on February 29th, 2012, 12:12 PM
Why does the matryoshka scenario occur, out of interest? What causes it to implant the skeleton inside default?
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Nao on February 29th, 2012, 12:17 PM
I don't remember, I'll admit. Last time it happened, it was because of a failed query.
I never looked much into Errors.php, myself.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Arantor on March 10th, 2012, 01:23 PM
Hmm, I still get the nesting sometimes with fatal errors and not with others. It tends to be database errors that trigger the behaviour, whereas most manual invocations of fatal_lang_error don't cause it. I still think we need to have the error handler replace <default>

Mind you in the event of a fatal error (assuming it isn't a template error), we probably should consider dropping as many templates as possible because imagine the situation: a portal early in processing adds its templates to the skeleton but never populates them until later, all the added templates could fail too, though I'd probably suggest in that scenario there's a fundamental bug in the portal for not populating its data when adding template blocks/layers.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Nao on March 11th, 2012, 09:34 AM
Care to look into this yourself? I'm dead after a hectic weekend...
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Arantor on March 11th, 2012, 01:13 PM
I will at some point, but it probably won't be today.
Title: Re: Possible incorrect behaviour in fatal error handling?
Post by: Nao on March 11th, 2012, 02:22 PM
Ok!