[Bps-public-commit] dbix-searchbuilder branch, return-validate-message-in-set, created. 1.61-2-g05bf297

Jason May jasonmay at bestpractical.com
Mon Oct 3 15:36:28 EDT 2011


The branch, return-validate-message-in-set has been created
        at  05bf297d4e09ca706acce9cc5769f8933aa8a1f7 (commit)

- Log -----------------------------------------------------------------
commit 05bf297d4e09ca706acce9cc5769f8933aa8a1f7
Author: Jason May <jasonmay at bestpractical.com>
Date:   Tue Sep 27 15:14:53 2011 -0400

    Use the Validate message if one was returned
    
    This allows for more descriptive messages validations run when a new
    column is set.

diff --git a/lib/DBIx/SearchBuilder/Record.pm b/lib/DBIx/SearchBuilder/Record.pm
index 5bd4cf3..71efd3a 100755
--- a/lib/DBIx/SearchBuilder/Record.pm
+++ b/lib/DBIx/SearchBuilder/Record.pm
@@ -813,12 +813,14 @@ sub __Set {
 
 
     my $method = "Validate" . $args{'Column'};
-    unless ( $self->$method( $args{'Value'} ) ) {
-        $ret->as_array( 0, 'Illegal value for ' . $args{'Column'} );
+    my ($val, $msg) = $self->$method( $args{'Value'} );
+    unless ( $val ) {
+        $msg = 'Illegal value for ' . $args{'Column'} unless defined $msg;
+        $ret->as_array( 0, $msg );
         $ret->as_error(
             errno        => 3,
             do_backtrace => 0,
-            message      => "Illegal value for " . $args{'Column'}
+            message      => $msg,
         );
         return ( $ret->return_value );
     }
@@ -842,7 +844,7 @@ sub __Set {
         }
 
 
-    my $val = $self->_Handle->UpdateRecordValue(%args);
+    $val = $self->_Handle->UpdateRecordValue(%args);
     unless ($val) {
         my $message = 
             $args{'Column'} . " could not be set to " . $args{'Value'} . "." ;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list