Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Trying to get DBIx::Class::Result::Validation to work

by moritz (Cardinal)
on Sep 29, 2012 at 07:46 UTC ( #996352=note: print w/replies, xml ) Need Help??

in reply to [more detail added] Trying to get DBIx::Class::Result::Validation to work

I've already said that in CB, but repeating it here for the benefit of others:

the error is getting set as expected, but it croaks rather than gets encapsulated somewhere

That part puzzles me. If a validation fails, I do expect it to throw an error. That gives you the opportunity to catch the exception wherever you want in your code, and deal with it there.

If it didn't throw the exception, but encapsulated it somewhere, would the operation just fail silently if the validation failed? And what would the calling code make of that? That doesn't strike me as a useful modus operandi.

(Disclaimer: I've never worked with dbic::Result::Validation, I'm merely applying my common sense here).

Update: Answer to a new question after OP's update:

However, I still can't work out how to get to the error data

I'd guess that the exception is an objet of type DBIx::Class::Result::Validation::VException, and you can use the message and object accessors.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996352]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2016-10-28 00:21 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (373 votes). Check out past polls.