Exception.pm


NAME

Communiware::Exception - base class for Communiware exceptions


SYNOPSYS

        use Communiware::Exception::Derived;
        eval {
                Communiware::Exception::Derived->throw($key=>$value, ...);
        };
        warn "$@" if $@;


FUNCTIONS

operator``''

        warn "$@";

Used to convert exception to a string.

throw

        Communiware::Exception::Derived->throw(key1=>value1, ..., keyN=>valueN);

Factory method. Creates a new exception with parameters specified and throws it (with die).

new

        Communiware::Exception::Derived->new(key1=>value1, ..., keyN=>valueN);

Constructor. Stores parameters as attributes.

message

        warn $exception->message;

Generates message of an exception. In the base class it is trivial (prints a `message' attribute) and is likely to override in derived classes.

log_msg

        log($@->log_msg);

Message for logging. If key `log_msg' exists, its value is used, otherwise a `message' method is called.

type

        warn $exception->type;

Type of exception. Allowed types: * BAD_DATE_FORMAT * UNKNOWN

stack_throw

        Communiware::Exception::stack_throw(sprintf args);

Replacement for Carp::confess. Dumps arguments of function calls in a stack by Data::Dumper.

16 октябрь 2007 13:44