[vhffs-dev] [1231] Using different error codes for different errors.

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1231
Author:   beuss
Date:     2008-06-26 11:36:41 +0200 (Thu, 26 Jun 2008)

Log Message:
-----------
Using different error codes for different errors.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Services/MailingList.pm


Modified: trunk/vhffs-api/src/Vhffs/Services/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/MailingList.pm	2008-06-24 15:54:48 UTC (rev 1230)
+++ trunk/vhffs-api/src/Vhffs/Services/MailingList.pm	2008-06-26 09:36:41 UTC (rev 1231)
@@ -199,6 +199,9 @@
     my $sql = 'UPDATE vhffs_ml SET prefix = ?, open_archive = ?, reply_to = ?, sub_ctrl = ?, post_ctrl = ?, signature = ? WHERE ml_id = ?';
     my $dbh = $self->get_main->get_db_object();
     $dbh->do($sql, undef, $self->{prefix}, $self->{open_archive}, $self->{reply_to}, $self->{sub_ctrl}, $self->{post_ctrl}, $self->{signature}, $self->{ml_id});
+    open PROUT, '>', '/tmp/prout';
+    print PROUT "$sql | ".$self->{prefix}.', '.$self->{open_archive}.', '.$self->{reply_to}.', '.$self->{sub_ctrl}.', '.$self->{post_ctrl}.', '.$self->{signature}.', '.$self->{ml_id};
+    close PROUT;
 
     return -3 if( $self->SUPER::commit < 0 );
 
@@ -226,11 +229,11 @@
 
     return -1 unless( Vhffs::Functions::valid_mail( $subscriber ) );
     return -2 if( $subscriber =~ /[<>\s]/ );
-    return -1 if( ! ( $right =~ /^[\d]+$/ ) );
+    return -3 if( ! ( $right =~ /^[\d]+$/ ) );
 
     my $sql = 'INSERT INTO vhffs_ml_subscribers (member, perm, hash, ml_id, language) VALUES (?, ?, NULL, ?, NULL)';
     my $dbh = $self->get_main->get_db_object();
-    $dbh->do($sql, undef, $subscriber, $right, $self->{ml_id}) or return -2;
+    $dbh->do($sql, undef, $subscriber, $right, $self->{ml_id}) or return -4;
 
     my $id = $dbh->last_insert_id(undef, undef, 'vhffs_ml_subscribers', undef);
 
@@ -468,7 +471,7 @@
 {
 	my( $self , $value ) = @_;
 	return -1 unless ( $value =~ /\d+/ );
-	return -1 if( $value < Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED || $value > Vhffs::Constants::ML_SUBSCRIBE_CLOSED );
+	return -2 if( $value < Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED || $value > Vhffs::Constants::ML_SUBSCRIBE_CLOSED );
 	$self->{'sub_ctrl'} = $value;
 	return 0;
 }
@@ -477,7 +480,7 @@
 {
 	my( $self , $value ) = @_;
 	return -1 unless ( $value =~ /\d+/ );
-	return -1 if ( $value < Vhffs::Constants::ML_POSTING_OPEN_ALL || $value > Vhffs::Constants::ML_POSTING_ADMINS_ONLY );
+	return -2 if ( $value < Vhffs::Constants::ML_POSTING_OPEN_ALL || $value > Vhffs::Constants::ML_POSTING_ADMINS_ONLY );
 	$self->{'post_ctrl'} = $value;
 	return 0;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/