projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fc1dd91
)
RT#7869: fix error messages when send_email fails in the job queue
author
mark
<mark>
Tue, 15 Jun 2010 05:10:12 +0000
(
05:10
+0000)
committer
mark
<mark>
Tue, 15 Jun 2010 05:10:12 +0000
(
05:10
+0000)
FS/FS/Daemon.pm
patch
|
blob
|
history
FS/FS/Misc.pm
patch
|
blob
|
history
diff --git
a/FS/FS/Daemon.pm
b/FS/FS/Daemon.pm
index
ca18134
..
f92a2ee
100644
(file)
--- a/
FS/FS/Daemon.pm
+++ b/
FS/FS/Daemon.pm
@@
-83,6
+83,7
@@
sub myexit {
}
sub _die {
}
sub _die {
+ die @_ if $^S; # $^S = 1 during an eval(), don't break exception handling
my $msg = shift;
unlink $pid_file if -e $pid_file;
_logmsg($msg);
my $msg = shift;
unlink $pid_file if -e $pid_file;
_logmsg($msg);
diff --git
a/FS/FS/Misc.pm
b/FS/FS/Misc.pm
index
b275c9d
..
895681f
100644
(file)
--- a/
FS/FS/Misc.pm
+++ b/
FS/FS/Misc.pm
@@
-353,12
+353,16
@@
sub send_email {
$smtp_opt{'ssl'} = 1 if defined($enc) && $enc eq 'tls';
$transport = Email::Sender::Transport::SMTP->new( %smtp_opt );
}
$smtp_opt{'ssl'} = 1 if defined($enc) && $enc eq 'tls';
$transport = Email::Sender::Transport::SMTP->new( %smtp_opt );
}
-
- eval { sendmail($message, { transport => $transport }); };
- ref($@) eq 'Email::Sender::Failure'
- ? ( $@->code ? $@->code.' ' : '' ). $@->message
- : $@;
-
+
+ local $@; # just in case
+ eval { sendmail($message, { transport => $transport }) };
+
+ if(ref($@) and $@->isa('Email::Sender::Failure')) {
+ return ($@->code ? $@->code.' ' : '').$@->message
+ }
+ else {
+ return $@;
+ }
}
=item send_fax OPTION => VALUE ...
}
=item send_fax OPTION => VALUE ...