Error Handling

Error handling within controllers

We have a zillion ways of including errors, and each time I've written a new page I've had to look back at older examples and decide which (among the many) to follow for this page. So to simplify things, I've written a DW::FormErrors module which aims to make error handling standard and simple.

Here is the bare-bones example of what to do.

In :

In :

.error.ml_string=Error message

.error.ml_string_with_arguments=Error message with key

On pages that use Foundation (newer pages, or newly converted pages), the errors will be displayed automatically in two places: at the top of the screen, and near the form field with  (if there is one).

If you need to include the errors manually for any reason (though you really shouldn't!), you can display the errors by putting this at the top of your file in views/*.tt:

[%- PROCESS block.errors -%]