Browse Source

Fix the error handling on the AJAX signoff tool

Turns out that you have to attach files to bugs before changing the
bug's status. Also, better error reporting is a good thing. So, here
is another commit.
origin
Jared Camins-Esakov 8 years ago
parent
commit
490dd31f62
  1. 23
      embedded-signoffs/signoff.pl

23
embedded-signoffs/signoff.pl

@ -138,13 +138,6 @@ elsif ( $op eq 'signoff' ) {
$bz->obsolete_attachment( 'id' => $_ );
}
eval {
# This is sickening, but WWW::Bugzilla is rather limited and will not
# accept custom statuses using the nice ->change_status() object method
$bz->{'status'} = 'Signed Off';
$bz->additional_comments(
"Patch tested and signoff automatically uploaded by $name <$email>\n$notes"
);
foreach (@files) {
my $desc = $_;
$desc =~ s#^.*/([^/]*)$#$1#;
@ -154,6 +147,22 @@ elsif ( $op eq 'signoff' ) {
is_patch => 1
);
}
};
if ($@) {
print to_json(
{
'error' => "Encountered errors uploading attachments: $@"
}
);
}
eval {
# This is sickening, but WWW::Bugzilla is rather limited and will not
# accept custom statuses using the nice ->change_status() object method
$bz->{'status'} = 'Signed Off';
$bz->additional_comments(
"Patch tested and signoff automatically uploaded by $name <$email>\n$notes"
);
$bz->commit;
};
if ($@) {

Loading…
Cancel
Save