TT#68300 Add an explicit newline to die calls

This disables the magic behavior of die() which prints the filename and
line number.

Change-Id: I6f89d88c8b0f2c45880f4a93d01c8e9cfa214f56
changes/46/34746/2
Guillem Jover 6 years ago
parent 9fd9a52a3b
commit 328102ef29

@ -49,7 +49,7 @@ sub usage {
sub load_config {
$config = XML::Simple->new()->XMLin($config_file, ForceArray => [ 'credit_warnings' ])
or die "Cannot load config: $config_file: $ERRNO";
or die "Cannot load config: $config_file: $ERRNO\n";
return;
}
@ -94,7 +94,7 @@ EOF
);
Email::Sender::Simple->send($email, { transport => $transport })
or die sprintf "Cannot send credit warning notification to %s: $ERRNO",
or die sprintf "Cannot send credit warning notification to %s: $ERRNO\n",
$email->header('To');
return;
}
@ -110,7 +110,7 @@ sub get_data {
);
my @result = ();
while (my $res = $client->next_page($uri)) {
die $res->result unless $res->is_success;
die "$res->result\n" unless $res->is_success;
my $res_hash = $res->as_hash;
my $data = $res_hash->{_embedded}{'ngcp:'.$link};
if ('ARRAY' eq ref $data) {
@ -143,10 +143,10 @@ sub main {
: [ $config->{credit_warnings} ];
foreach my $cwarning (@{$cwarnings}) {
unless ($cwarning->{recipients}) {
die "No recipients defined for domain: $cwarning->{domain}";
die "No recipients defined for domain: $cwarning->{domain}\n";
}
unless ($cwarning->{domain}) {
die "Missing domain in a credit warning check";
die "Missing domain in a credit warning check\n";
}
my @contracts;
get_data(sprintf('/api/customerbalances/?no_count=true&domain=%s&prepaid=1',

@ -66,7 +66,8 @@ sub usage {
sub load_config {
$config = XML::Simple->new()->XMLin($config_file, ForceArray => 0)
or die "Cannot load config: $config_file: $ERRNO";
or die "Cannot load config: $config_file: $ERRNO\n";
return;
}
@ -80,7 +81,7 @@ sub get_data {
my @result = ();
while (my $res = $client->next_page($uri)) {
die $res->result unless $res->is_success;
die "$res->result\n" unless $res->is_success;
my $res_hash = $res->as_hash;
my $data = $res_hash->{_embedded}{'ngcp:'.$link};
if ('ARRAY' eq ref $data) {
@ -117,7 +118,8 @@ sub get_email_template {
}
unless ($selected_template) {
die sprintf "No template 'customer_fraud_%s_default_email' OR 'customer_fraud_%s_email' is defined.", $lock_type, $lock_type;
die sprintf "No template 'customer_fraud_%s_default_email' OR 'customer_fraud_%s_email' is defined.\n",
$lock_type, $lock_type;
}
return $selected_template;
@ -151,9 +153,9 @@ sub send_email {
$template->{$field} = $out if $out;
}
die "'To' header is empty in the email" unless $event->{interval_notify};
die "'From' header is empty in the email" unless $template->{from_email};
die "'Subject' header is empty in the email" unless $template->{subject};
die "'To' header is empty in the email\n" unless $event->{interval_notify};
die "'From' header is empty in the email\n" unless $template->{from_email};
die "'Subject' header is empty in the email\n" unless $template->{subject};
my $transport = Email::Sender::Transport::Sendmail->new;
my $email = Email::Simple->create(
@ -166,7 +168,7 @@ sub send_email {
);
Email::Sender::Simple->send($email, { transport => $transport })
or die sprintf "Cannot send fraud daily lock notification to %s: $ERRNO",
or die sprintf "Cannot send fraud daily lock notification to %s: $ERRNO\n",
$email->header('To');
update_notify_status($event);

Loading…
Cancel
Save