[Pangloss] [RFC] OpenFrame AppKit ideas

Jean-Michel Hiver jhiver at mkdoc.com
Wed Apr 9 12:22:29 BST 2003


> >The exception mechanism does not work when you're validating a form 
> >because you do not want a validation error to be fatal since you might 
> >want to report multiple errors.
> 
> True, but in that case I wouldn't use exceptions - I'd bung the errors 
> into the ErrorCatcher manually.

Gotcha. That seems fine.


> I'm not sure if a bunch of conditionals in the template are a bad thing 
> - its presentation logic, so that's the right place for it.  Still, if 
> you want to display all the errors at the beginning of a page then yes, 
> it gets annoying. Which is why I would choose not to do it that way.

Which we usually do for accessibility reasons. Screen readers are
apparently much easier when all the errors are read out first, which
means that they should all be at the beginning.


> Another point, the major difference between:
> 
>     <li petal:content="structure some_error/as_xhtml">
>       An Evil Error has occurred!
>     </li>
> 
> and:
> 
>     <li petal:if="some_error">
>       An Evil Error has occurred!
>     </li>
> 
> isn't the if statement, it's where the error string comes from: the 
> error object, or the template.  I'd prefer to keep the string in the 
> template where it's easily localized (in context too).

But surely if your errors are using templates then they can be localized
too.

The motive for embedding error presentation into error objects is that
'some_error' might happen in 5 different templates, in which case you'll
end up having the error string 'An Evil Error has occurred!' 5 times.




> >But I also like the idea of your error having an ID for each error so 
> >that you can override the way the error is presented if you want to...
> >
> >I suppose as a rule of thumb you could have ID = template name. Then 
> >your errors would be templatable, potentially easily multi-lingual, 
> >but also overridable. Although I doubt very much that you'll have to 
> >change them very often. After all 'Not enough disk space' remains 'not 
> >enough disk space'... If not, it's probably another kind of error. Am 
> >I making any sense?
> 
> I'm not sure I understand the advantage of this...  Yes, you can have 
> application-wide errors, but you probably don't want to tie them to an 
> individual error template.  Unless you include that template when the 
> error pops up, but that should be done at the template level anyways.

I think it's best to have a reasonable, localized default (hence error
objects using templates) that you can override if you need anyway.

That being said I understand that you have a problem with tying errors
to HTML. Maybe you could use a bridge pattern to dissociate the 'error'
bit from the 'html' bit?

Cheers,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver at mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/


More information about the Pangloss mailing list