
Bio::Phylo::Util::Exceptions - Exception classes for Bio::Phylo.

use Bio::Phylo::Forest::Node;
my $node = Bio::Phylo::Forest::Node->new;
# now let's try something illegal
eval {
$node->set_branch_length( 'non-numerical value' );
};
# have an error
if ( $@ && UNIVERSAL::isa( $@, 'Bio::Phylo::Util::Exception' ) ) {
# print out where the error came from
print $@->trace->as_string;
}

Sometimes, Bio::Phylo dies. If this happens because you did something that brought Bio::Phylo into an undefined and dangerous state (such as might happen if you provide a non-numerical value for a setter that needs numbers), Bio::Phylo will throw an "exception", a special form of the $@ variable that is a blessed object with useful methods to help you diagnose the problem.
This package defines the exceptions that can be thrown by Bio::Phylo. There are no serviceable parts inside. Refer to the Exception::Class perldoc for more examples on how to catch exceptions and show traces.

Thrown when anything other than a number that passes Scalar::Util's looks_like_number test is given as an argument to a method that expects a number.
Thrown when a string that contains any of the characters ():;, is given as an argument to a method that expects a name.
Thrown when a non-existing parser or unparser format is requested, in calls such as parse( -format => 'newik', -string => $string ), where 'newik' doesn't exist.
Thrown when an odd number of arguments has been specified. This might happen if you call a method that requires named arguments and the key/value pairs don't seem to match up.
Thrown when a method is called that requires an object as an argument, and the wrong type of object is specified.
Trown when an indirect method call is attempted through the $obj->get('unknown_method') interface, and the object doesn't seem to implement the requested method.
Thrown when something undefined is wrong with the supplied arguments.
Thrown when a file specified as an argument does not exist or is not readable.
Thrown when there is an error loading a requested extension.
Thrown when an entity is requested that falls outside of the range of objects contained by a Bio::Phylo::Listable subclass, probably through the $obj->get_by_index($i) method call.
Thrown when an interface method is called instead of the implementation by the child class.
Thrown when a deprecated method is called.

Serializes invocant to XML.
Type : Exception Title : throw Usage : $class->throw( error => 'An exception was thrown!' ); Function: Throws exception Returns : A Bio::Phylo::Util::Exceptions object Args : None

Also see the manual: Bio::Phylo::Manual.

$Id: Exceptions.pm 4224 2007-07-16 03:16:05Z rvosa $