| 1 |
NAME |
| 2 |
Catalyst::Plugin::CustomErrorMessage - Catalyst plugin to have more |
| 3 |
"cute" error message. |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
use Catalyst qw( CustomErrorMessage ); |
| 7 |
|
| 8 |
# optional (values in this example are the defaults) |
| 9 |
__PACKAGE__->config->{'custom-error-message'}->{'uri-for-not-found'} = '/'; |
| 10 |
__PACKAGE__->config->{'custom-error-message'}->{'error-template'} = 'error.tt2'; |
| 11 |
__PACKAGE__->config->{'custom-error-message'}->{'content-type'} = 'text/html; charset=utf-8'; |
| 12 |
__PACKAGE__->config->{'custom-error-message'}->{'view-name'} = 'TT'; |
| 13 |
__PACKAGE__->config->{'custom-error-message'}->{'response-status'} = 500; |
| 14 |
|
| 15 |
DESCRIPTION |
| 16 |
You can use this module if you want to get rid of: |
| 17 |
|
| 18 |
(en) Please come back later |
| 19 |
(fr) SVP veuillez revenir plus tard |
| 20 |
(de) Bitte versuchen sie es spaeter nocheinmal |
| 21 |
(at) Konnten's bitt'schoen spaeter nochmal reinschauen |
| 22 |
(no) Vennligst prov igjen senere |
| 23 |
(dk) Venligst prov igen senere |
| 24 |
(pl) Prosze sprobowac pozniej |
| 25 |
|
| 26 |
What it does is that it inherites finalize_error to $c object. |
| 27 |
|
| 28 |
See finalize_error() function. |
| 29 |
|
| 30 |
FUNCTIONS |
| 31 |
finalize_error |
| 32 |
In debug mode this function is skipped and user sees the original |
| 33 |
Catalyst error page in debug mode. |
| 34 |
|
| 35 |
In "production" (non debug) mode it will return page with template set |
| 36 |
in |
| 37 |
|
| 38 |
$c->config->{'custom-error-message'}->{'error-template'} |
| 39 |
|| |
| 40 |
'error.tt2' |
| 41 |
|
| 42 |
$c->stash->{'finalize_error'} will be set to contain the error message. |
| 43 |
|
| 44 |
For non existing resources (like misspelled url-s) if will do http |
| 45 |
redirect to |
| 46 |
|
| 47 |
$c->uri_for( |
| 48 |
$c->config->{'custom-error-message'}->{'uri-for-not-found'} |
| 49 |
|| |
| 50 |
'/' |
| 51 |
) |
| 52 |
|
| 53 |
$c->flash->{'finalize_error'} will be set to contain the error message. |
| 54 |
|
| 55 |
To set different view name configure: |
| 56 |
|
| 57 |
$c->config->{'custom-error-message'}->{'view-name'} = 'Mason'; |
| 58 |
|
| 59 |
Content-type and response status can be configured via: |
| 60 |
|
| 61 |
$c->config->{'custom-error-message'}->{'content-type'} = 'text/plain; charset=utf-8'; |
| 62 |
$c->config->{'custom-error-message'}->{'response-status'} = 500; |
| 63 |
|
| 64 |
AUTHOR |
| 65 |
Jozef Kutej - <[email protected]> |
| 66 |
|
| 67 |
COPYRIGHT AND LICENSE |
| 68 |
Copyright (C) 2006 by Jozef Kutej |
| 69 |
|
| 70 |
This library is free software; you can redistribute it and/or modify it |
| 71 |
under the same terms as Perl itself, either Perl version 5.8.4 or, at |
| 72 |
your option, any later version of Perl 5 you may have available. |
| 73 |
|