NAME

Catalyst::Plugin::CustomErrorMessage - Catalyst plugin to have more "cute" error message.

SYNOPSIS

use Catalyst qw( CustomErrorMessage );

# optional
__PACKAGE__->config->{'custome-error-messsage'}->{'uri-for-not-found'} = '/not_found_error';
__PACKAGE__->config->{'custome-error-messsage'}->{'error-template'}    = 'error.tt2';

DESCRIPTION

You can use this module if you want to get rid of:

(en) Please come back later
(fr) SVP veuillez revenir plus tard
(de) Bitte versuchen sie es spaeter nocheinmal
(at) Konnten's bitt'schoen spaeter nochmal reinschauen
(no) Vennligst prov igjen senere
(dk) Venligst prov igen senere
(pl) Prosze sprobowac pozniej

What it does is that it inherites finalize_error to $c object.

See finalize_error() function.

FUNCTIONS

finalize_error

In debug mode this function is skipped and user sees the original Catalyst error page in debug mode.

In "production" (non debug) mode it will return page with template set in

$c->config->{'custome-error-messsage'}->{'error-template'}
||
'error.tt2'

$c->stash->{'finalize_error'} will be set to contain the error message.

For non existing resources (like misspelled url-s) if will do http redirect to

$c->uri_for(
	$c->config->{'custome-error-messsage'}->{'uri-for-not-found'}
	||
	'/'
)

$c->flash->{'finalize_error'} will be set to contain the error message.

This works if you are using Template Toolkit and the view is named "TT". The "tutorial" way. If you want it the different way just copy this module, place it to the lib/Catalyst/Plugin folder and edit out for your needs. If we can improve this example by some config switch, so that it will be more universal, then please let me know and i'll put it there.

AUTHOR

Jozef Kutej - <jozef@kutej.net>

Authorization and Accounting contributed by Rubio Vaughan <rubio@passim.net>

TODO

More universal? Looking forward for your suggestions.

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Jozef Kutej

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.