Use the old overloaded object string to pass around what we can assume in
most places is a string.
--- /dev/null
+
+package MooseX::Types::Structured::TypeError;
+
+use Moose;
+
+has 'constraint' =>
+ is => "ro",
+ ;
+
+has 'index' =>
+ is => "ro",
+ ;
+
+has 'value' =>
+ is => "ro",
+ predicate => "has_value",
+ ;
+
+use overload '""' => sub { shift->message }, # stringify
+ fallback => 1;
+
+sub message {
+ my $self = shift;
+ $self->constraint->get_message($self->has_value ? $self->value : 'NULL');
+}
+
+1;