Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
clausnagel committed Dec 2, 2023
1 parent e51a0eb commit 35fc5c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,10 @@ private DeleteOptions getExportOptions() {
private void abort(long id, Throwable e) {
synchronized (lock) {
if (shouldRun) {
shouldRun = false;
logger.warn("Database delete aborted due to an error.");
helper.logException("Failed to delete feature (ID: " + id + ").", e);
}

shouldRun = false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,14 @@ protected WriteOptions getWriteOptions(DatabaseAdapter databaseAdapter) {
private void abort(Feature feature, long id, Throwable e) {
synchronized (lock) {
if (shouldRun) {
String message;
if (feature == null) {
message = "Failed to export feature (ID: " + id + ").";
} else {
String objectId = feature.getObjectId().orElse(null);
message = "Failed to export " + feature.getFeatureType().getLocalName() +
(objectId != null ? " '" + objectId + "'" : "") +
" (ID: " + id + ").";
}

shouldRun = false;
logger.warn("Database export aborted due to an error.");
helper.logException(message, e);
helper.logException(feature == null ?
"Failed to export feature (ID: " + id + ")." :
"Failed to export " + feature.getFeatureType().getLocalName() +
feature.getObjectId().map(objectId -> " '" + objectId + "'").orElse("") +
" (ID: " + id + ").", e);
}

shouldRun = false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,11 @@ protected ImportOptions getImportOptions() {
private void abort(Feature feature, Throwable e) {
synchronized (lock) {
if (shouldRun) {
shouldRun = false;
logger.warn("Database import aborted due to an error.");
helper.logException("Failed to import " + feature.getFeatureType().getLocalName() +
" '" + feature.getObjectId().orElse("unknown ID") + "'.", e);
}

shouldRun = false;
}
}
}

0 comments on commit 35fc5c4

Please sign in to comment.