[Xml-compile] Clarification XML::Schema::Compile validation option for writers

HERMIER Christophe christophe.hermier at quickfds.com
Thu Dec 6 07:51:35 GMT 2012


Le 06/12/2012 02:13, Richard Head Jr. a écrit :
> Error handling is not ideal and, without a larger "framework" in 
> place, messages can be cryptic and or limited. For example, a 
> particular object may have 10 validation errors but the exception 
> includes only one. It is possible that one will have to to bounce 
> their objects off the WRITER 10 times to resolve all of the errors.
>>> 3. For typemaps + objects, errors with context refer to xpath locations
>> What do you expect differently?  Example?
> Let's say that package has a version attribute that's mapped to an emumeration:
>
> my $pkg = Package->new(version => 'bad!');
> # ...
> $writer->($doc, $pkg);
>
> When the value given for version is not part of the enum this error is raised:
>
> error: invalid enumerate `bad!' at {http://example.com}package#facet
>
> It would be nice if there was a hook on the object that allows one to map errors to object attributes, making it possible to create a message that at least included the name of the invalid attribute (i.e., something less cryptic).

I totally agree : it's really painfull to get one error at a time !






More information about the Xml-compile mailing list