6 use parent qw(Exception::Class::Base);
8 sub _defaults { return () }
10 sub message { goto &error }
13 my ($self, @params) = @_;
15 return $self->{message} if ($self->{message} // '') ne '';
17 return $self->SUPER::error(@params) if !$self->can('_defaults');
19 my %defaults = $self->_defaults;
20 return $self->SUPER::error(@params) if !$defaults{error_template};
22 my ($format, @fields) = @{ $defaults{error_template} };
23 return sprintf $format, map { $self->$_ } @fields;