diff options
Diffstat (limited to 'lib/MooseX/Validation/Doctypes')
-rw-r--r-- | lib/MooseX/Validation/Doctypes/Errors.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/MooseX/Validation/Doctypes/Errors.pm b/lib/MooseX/Validation/Doctypes/Errors.pm index 023493c..ca4d54d 100644 --- a/lib/MooseX/Validation/Doctypes/Errors.pm +++ b/lib/MooseX/Validation/Doctypes/Errors.pm @@ -104,6 +104,15 @@ has extra_data => ( predicate => 'has_extra_data', ); +sub TO_JSON { + my $self = shift; + + return { + ($self->has_errors ? (errors => $self->errors) : ()), + ($self->has_extra_data ? (extra_data => $self->extra_data) : ()), + }; +} + __PACKAGE__->meta->make_immutable; no Moose; |