The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SweetPea::Application::Error - Error handling for SweetPea-Application.

SYNOPSIS

    ... from inside SweetPea::Application or a Controller;
    $s->error->message('The application did something very wrong here');
    $s->error->message('I made a boo boo', 'Im still not working');
    die if $s->error->count;
    print $s->error->report;
    print $s->error->report("\n"); $s->error->{delimiter} = "<br/>";

METHODS

new

     The new method instantiates a new SweetPea::Application::Error object
    which stores and renders error messages for the application.
    
    $s->plug( 'error', sub { return SweetPea::Application::Error->new($s); });

message

    The message method is responsible for storing passed in error messages for
    later retrieval and rendering.
    
    $s->error->message('Mail document was not sent');
    $s->error->message('Mail document was not sent', 'SMTP connection error');

count

    The count method returns the number of error messages currently existing in 
    the error messages container.
    
    die if $s->error->count;

clear

    the clear method resets the error message container.
    
    $s->error->clear;

report

    The report method is responsible for displaying all stored error messages
    using the defined message delimiter.
    
    print $s->error->report;
    print $s->error->report("\n");
    

AUTHOR

Al Newkirk, <al.newkirk at awnstudio.com>