Skip to content

Commit d2947b9

Browse files
committed
Improve error handling
1 parent 6cad6d9 commit d2947b9

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/main/java/airsquared/blobsaver/app/LibimobiledeviceUtil.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,18 @@ private LibimobiledeviceException(String message, ErrorCodeType errorType, int e
359359

360360
public void showErrorAlert() {
361361
String message = getMessage();
362-
if (reportable) {
362+
if (reportable && (errorType == ErrorCodeType.lockdownd_error || errorType == ErrorCodeType.idevice_error
363+
|| errorType == ErrorCodeType.irecv_error)) {
364+
ButtonType help = new ButtonType("Help");
365+
if (help.equals(Utils.showUnreportableError(message, help, ButtonType.OK))) {
366+
Utils.openURL("https://github.com/airsquared/blobsaver/wiki/Errors-reading-from-device");
367+
}
368+
} else if (reportable) {
363369
Utils.showReportableError(message);
364-
} else if (ErrorCodeType.idevice_error.equals(errorType) && errorCode == -3 && Platform.isWindows()) {
370+
} else if (ErrorCodeType.idevice_error.equals(errorType) && errorCode == -3) {
365371
message += "\n\nEnsure iTunes or Apple's iOS Drivers are installed.";
366372
ButtonType downloadItunes = new ButtonType("Download iTunes");
367-
if (downloadItunes.equals(Utils.showUnreportableError(message, downloadItunes))) {
373+
if (downloadItunes.equals(Utils.showUnreportableError(message, downloadItunes, ButtonType.OK))) {
368374
Utils.openURL("https://www.apple.com/itunes/download/win64");
369375
}
370376
} else {

src/main/java/airsquared/blobsaver/app/Utils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,22 @@ static void reportError(Alert alert, String toCopy) {
236236
}
237237

238238
static void showReportableError(String msg) {
239-
Alert alert = new Alert(Alert.AlertType.ERROR, msg + "\n\nPlease create a new issue on Github if you need more help.", githubIssue, ButtonType.CANCEL);
239+
Alert alert = new Alert(Alert.AlertType.ERROR, msg + "\n\nIf you need more help, you can create a new issue on GitHub.", githubIssue, ButtonType.CANCEL);
240240
resizeAlertButtons(alert);
241241
alert.showAndWait();
242242
reportError(alert);
243243
}
244244

245245
static void showReportableError(String msg, String toCopy) {
246-
Alert alert = new Alert(Alert.AlertType.ERROR, msg + "\n\nThe log has been copied to your clipboard. You may create a new issue on GitHub.", githubIssue, ButtonType.CANCEL);
246+
Alert alert = new Alert(Alert.AlertType.ERROR, msg + "\n\nThe log has been copied to your clipboard. If you need more help, you can create a new issue on GitHub.", githubIssue, ButtonType.CANCEL);
247247
resizeAlertButtons(alert);
248248
alert.showAndWait();
249249
reportError(alert, toCopy);
250250
}
251251

252252
static ButtonType showUnreportableError(String msg, ButtonType... buttons) {
253253
Alert alert = new Alert(Alert.AlertType.ERROR, msg, buttons);
254+
resizeAlertButtons(alert);
254255
alert.showAndWait();
255256
return alert.getResult();
256257
}

0 commit comments

Comments
 (0)