Skip to content

Commit dfee943

Browse files
committed
CSSTUDIO-2572 Improve error handling when loading of a log entry is not successful.
1 parent 9dae047 commit dfee943

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/LogEntryDisplayController.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@
4141
import org.phoebus.olog.es.api.model.OlogLog;
4242
import org.phoebus.ui.javafx.ImageCache;
4343

44+
import java.util.logging.Level;
45+
import java.util.logging.Logger;
46+
4447

4548
public class LogEntryDisplayController {
4649

50+
static Logger log = Logger.getLogger(LogEntryDisplayController.class.getName());
51+
4752
@FXML
4853
@SuppressWarnings("unused")
4954
private SingleLogEntryDisplayController singleLogEntryDisplayController;
@@ -160,8 +165,13 @@ public void jumpToLogEntry() {
160165
return;
161166
}
162167

163-
if (logEntryTableViewController.goBackAndGoForwardActions.isPresent()) {
164-
logEntryTableViewController.goBackAndGoForwardActions.get().loadLogEntryWithID(logEntryIDToJumpTo);
168+
if (logEntryIDToJumpTo > 0) {
169+
if (logEntryTableViewController.goBackAndGoForwardActions.isPresent()) {
170+
boolean success = logEntryTableViewController.goBackAndGoForwardActions.get().loadLogEntryWithID(logEntryIDToJumpTo);
171+
if (!success) {
172+
log.log(Level.WARNING, "Error loading entry with log entry ID: " + logEntryIDToJumpTo + ".");
173+
}
174+
}
165175
}
166176
}
167177

app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/LogEntryTable.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,18 @@ private void addGoForwardAction() {
172172
}
173173
}
174174

175-
protected void loadLogEntryWithID(Long id) {
175+
protected boolean loadLogEntryWithID(Long id) {
176176
goForwardActions.clear();
177177
addGoBackAction();
178178

179-
LogEntry logEntry = controller.client.getLog(id);
180-
gotoLogEntry(logEntry);
179+
try {
180+
LogEntry logEntry = controller.client.getLog(id);
181+
gotoLogEntry(logEntry);
182+
return true;
183+
}
184+
catch (RuntimeException runtimeException) {
185+
return false;
186+
}
181187
}
182188

183189
protected void goBack() {

0 commit comments

Comments
 (0)