Make exception stringify as their message.
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Exception.pm
index d50adf9..4959e42 100644 (file)
@@ -34,6 +34,18 @@ Throws a fatal exception.
 
 =cut
 
+has message => (
+    is  => 'ro',
+    isa => 'Str',
+);
+
+use overload q{""} => \&as_string;
+
+sub as_string {
+    my ($self) = @_;
+    return $self->message;
+}
+
 sub throw {
     my $class  = shift;
     my %params = @_ == 1 ? ( error => $_[0] ) : @_;