Bug 38299: Use say_failure when printing update errors to the console
Bug 35681 added subroutines to print colored output from database
updates. Incorporate the subroutine say_failure into the error handling
in the upstream code, so that errors caught upstream can take advantage
of this new subroutine and display in red.
To test:
1. Apply patch for test dbrev
2. From the kshell, run updatedatabase
--> The messages for success, info, warning, and failure that were
explicitly printed in the dbrev are colored, but the database error
is not colored.
3. Apply other patches
4. Run updatedatabase again
--> All messages including the database error are now colored
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
bae04ca3fd
commit
c79d533a04
|
|
@ -42,6 +42,7 @@ use Koha::Database;
|
|||
use Koha;
|
||||
use Koha::DateUtils qw( dt_from_string output_pref );
|
||||
use Koha::Caches;
|
||||
use Koha::Installer::Output qw ( say_failure );
|
||||
|
||||
use MARC::Record;
|
||||
use MARC::File::XML ( BinaryEncoding => 'utf8' );
|
||||
|
|
@ -24301,7 +24302,7 @@ unless ( $ENV{HTTP_HOST} ) { # Is that correct?
|
|||
}
|
||||
for my $e ( @{ $report->{error} } ) {
|
||||
say Encode::encode_utf8(join "\n", @{$e->{output}});
|
||||
say Encode::encode_utf8("ERROR - " . $e->{error});
|
||||
say_failure( undef, Encode::encode_utf8("ERROR - " . $e->{error}) );
|
||||
$error_code = 1;
|
||||
}
|
||||
|
||||
|
|
@ -24312,7 +24313,7 @@ unless ( $ENV{HTTP_HOST} ) { # Is that correct?
|
|||
}
|
||||
for my $e ( @{ $report->{error} } ) {
|
||||
say Encode::encode_utf8(join "\n", @{$e->{output}});
|
||||
say Encode::encode_utf8("ERROR - " . $e->{error});
|
||||
say_failure( undef, Encode::encode_utf8("ERROR - " . $e->{error}) );
|
||||
$error_code = 1;
|
||||
}
|
||||
exit $error_code;
|
||||
|
|
|
|||
Loading…
Reference in New Issue