Using Exception::Class
- An example from RT::Client::REST
use Exception::Class (
'RT::Client::REST::OddNumberOfArgumentsException' => {
isa => __PACKAGE__,
description => "This means that we wanted name/value pairs",
},
'RT::Client::REST::InvaildObjectTypeException' => {
isa => __PACKAGE__,
description => "Invalid object type was specified",
},
'RT::Client::REST::MalformedRTResponseException' => {
isa => __PACKAGE__,
description => "Malformed RT response received from server",
},
# ...
);
RT::Client::REST::MalformedRTResponseException->throw(
message => "Cound not read ID of the modified object",
);