Bug 26312: (follow-up) Fix passing of exception messages
'error' has special meaning in exceptions so naming the fields: type, details Rather than only dealing with a single exception type, we generically get the ES exception info and pass it up. I could not recreate timeout still, however, I simply restarted the ES docker during commit stage to cause NoNodes exceptions Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> (cherry picked from commitcc8787bf87) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> (cherry picked from commit74284f4ddb) Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
parent
a60a3b26d7
commit
ee8177efc7
|
|
@ -25,7 +25,7 @@ use Exception::Class (
|
|||
'Koha::Exceptions::Elasticsearch::BadResponse' => {
|
||||
isa => 'Koha::Exceptions::Elasticsearch',
|
||||
description => 'Bad response received when submitting request to Elasticsearch',
|
||||
fields => [ 'error', 'details' ]
|
||||
fields => [ 'type', 'details' ]
|
||||
},
|
||||
'Koha::Exceptions::Elasticsearch::MARCFieldExprParseError' => {
|
||||
isa => 'Koha::Exceptions::Elasticsearch',
|
||||
|
|
|
|||
|
|
@ -125,12 +125,10 @@ sub update_index {
|
|||
carp "One or more ElasticSearch errors occurred when indexing documents";
|
||||
}
|
||||
} catch {
|
||||
if( ref $_ eq 'Search::Elasticsearch::Error::Timeout' ){
|
||||
Koha::Exceptions::Elasticsearch::BadResponse->throw(
|
||||
error => "Record commit failed.",
|
||||
details => "Timeout",
|
||||
type => $_->{type},
|
||||
details => $_->{text},
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
return $response;
|
||||
|
|
|
|||
|
|
@ -296,10 +296,8 @@ sub _do_reindex {
|
|||
_handle_response($response);
|
||||
_log( 1, "Commit complete\n" );
|
||||
} catch {
|
||||
if( ref $_ eq 'Koha::Exceptions::Elasticsearch::BadResponse'){
|
||||
_log(1,$_->{error});
|
||||
_log(2,$_->{details});
|
||||
}
|
||||
_log(1,"Elasticsearch exception thrown: ".$_->type."\n");
|
||||
_log(2,"Details: ".$_->details."\n");
|
||||
};
|
||||
$commit_count = $commit;
|
||||
@id_buffer = ();
|
||||
|
|
|
|||
Loading…
Reference in New Issue