[Rt-devel] Error propagation in RT::CustomField::Create.

Dmitri Tikhonov dtikhonov at vonage.com
Thu May 3 11:22:17 EDT 2007


Dear RTers,

it would be nice if RT::CustomField's Create() method propagated error 
messages from calls to SUPER::Create.  What follows is a patch against 
the latest 3.7 code 
(http://svn.bestpractical.com/cgi-bin/index.cgi/bps/view/rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm):

Thanks,

   - Dmitri.

--- CustomField_Overlay.pm-original     2007-05-03 17:03:28.000000000 +0000
+++ CustomField_Overlay.pm      2007-05-03 17:04:07.000000000 +0000
@@ -202,7 +202,7 @@
      my ($ok, $msg) = $self->_IsValidRegex( $args{'Pattern'} );
      return (0, $self->loc("Invalid pattern: [_1]", $msg)) unless $ok;

-    my $rv = $self->SUPER::Create(
+    my @rv = $self->SUPER::Create(
          Name        => $args{'Name'},
          Type        => $args{'Type'},
          MaxValues   => $args{'MaxValues'},
@@ -217,7 +217,7 @@
          $self->SetValuesClass( $args{'ValuesClass'} );
      }

-    return $rv unless exists $args{'Queue'};
+    return @rv unless exists $args{'Queue'};

      # Compat code -- create a new ObjectCustomField mapping
      my $OCF = RT::ObjectCustomField->new( $self->CurrentUser );
@@ -226,7 +226,7 @@
          ObjectId => $args{'Queue'},
      );

-    return $rv;
+    return @rv;
  }

  =head2 Load ID/NAME


More information about the Rt-devel mailing list