NAME

OpenInteract2::Exception - Base class for exceptions in OpenInteract

SYNOPSIS

# Standard usage

unless ( $user->check_password( $entered_password ) ) {
  OpenInteract2::Exception->throw( 'Bad login' );
}

# Pass a list of strings to form the message

unless ( $user->check_password( $entered_password ) ) {
  OpenInteract2::Exception->throw( 'Bad login', $object->login_attemplated )
}

# Using the exported shortcut

use OpenInteract2::Exception qw( oi_error );
oi_error( "Bad login", $object->login_attempted );

# Get all errors in a particular request

my @errors = OpenInteract2::Exception->get_stack;
print "Errors found during request:\n";
foreach my $e ( @errors ) {
   print "ERROR: ", $e->message, "\n";
}

# Also get this information from the OpenInteract2::Context:

CTX->throw( 'Bad login' );

my $errors = CTX->get_exceptions;
CTX->clear_exceptions;

DESCRIPTION

First, you should probably look at SPOPS::Exception for more usage examples, why we use exceptions, what they are intended for, etc.

This is the base class for all OpenInteract exceptions. It only adds a single optional field to the SPOPS::Exception class, but more importantly it allows you to distinguish between errors percolating from the data layer and errors in the application server.

It also adds a shortcut for throwing errors via the exported routine oi_error.

PROPERTIES

In addition to the properties outlined in SPOPS::Exception, this object has:

oi_package

List the OpenInteract package from which the exception was thrown. This is completely optional, for informational purposes only.

BUGS

None known.

TO DO

Nothing known.

SEE ALSO

SPOPS::Exception

OpenInteract2::Exception::Datasource

OpenInteract2::Exception::Parameter

OpenInteract2::Exception::Security

COPYRIGHT

Copyright (c) 2002-2003 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Chris Winters <chris@cwinters.com>