[Catalyst] error handling

Felix Antonius Wilhelm Ostmann ostmann at websuche.de
Mon Dec 10 15:09:45 GMT 2007


So you dont have any error :) you should be happy ;)

Angel Kolev schrieb:
> sub auto : Private {
>    my ($self, $c) = @_;
>    if (@{$c->error}) {
>        $c->stash->{error} = " Critical ERROR!! Probably missing data 
> in database.";
>        $c->forward('/error');
>        $c->error(0);
>        return 0;
>    }
> }
>
> This dont work. @{$c->error} or scalar @{$c->error} always print 0 in 
> my debug screen.
>
> Felix Antonius Wilhelm Ostmann wrote:
>> $c->error is a arrayref or not?
>>
>> So you must do this:
>>
>> if( @{$c->error} ) {
>> ...
>> }
>>
>> Angel Kolev schrieb:
>>> Hi,all. Can anyone eplain me a bit about error handling. Where i can 
>>> catch it and when? I use this:
>>>
>>> MyApp::C::MyController
>>>
>>> sub auto : Private {
>>>    my ($self, $c) = @_;
>>>    if ($c->error) {
>>>        $c->stash->{error} = " Critical ERROR!! ";
>>>        $c->forward('/error');
>>>        $c->error(0);
>>>        return 0;
>>>    }
>>>
>>> }
>>>
>>> This works but then all my subs in this controller are redirected to 
>>> /error.
>>>
>>> _______________________________________________
>>> List: Catalyst at lists.scsys.co.uk
>>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>>> Searchable archive: 
>>> http://www.mail-archive.com/catalyst@lists.rawmode.org/
>>> Dev site: http://dev.catalyst.perl.org/
>>>
>>>
>>
>>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: 
> http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>
>


-- 
Mit freundlichen Grüßen

Felix Antonius Wilhelm Ostmann
--------------------------------------------------
Websuche   Search   Technology   GmbH   &   Co. KG
Martinistraße 3  -  D-49080  Osnabrück  -  Germany
Tel.:   +49 541 40666-0 - Fax:    +49 541 40666-22
Email: info at websuche.de - Website: www.websuche.de
--------------------------------------------------
AG Osnabrück - HRA 200252 - Ust-Ident: DE814737310
Komplementärin:     Websuche   Search   Technology
Verwaltungs GmbH   -  AG Osnabrück  -   HRB 200359
Geschäftsführer:  Diplom Kaufmann Martin Steinkamp
--------------------------------------------------




More information about the Catalyst mailing list