-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide redundant information on fetcher exception #6569
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,10 +94,22 @@ public void search() { | |
BackgroundTask<ParserResult> task = BackgroundTask.wrap(() -> new ParserResult(activeFetcher.performSearch(getQuery().trim()))) | ||
.withInitialMessage(Localization.lang("Processing %0", getQuery())); | ||
|
||
task.onFailure(dialogService::showErrorDialogAndWait); | ||
task.onFailure(this::exceptionHandler); | ||
|
||
ImportEntriesDialog dialog = new ImportEntriesDialog(frame.getCurrentBasePanel().getBibDatabaseContext(), task); | ||
dialog.setTitle(activeFetcher.getName()); | ||
dialog.showAndWait(); | ||
} | ||
|
||
private void exceptionHandler(Exception exception) { | ||
if (exception.getClass().getName().equals("org.jabref.logic.importer.FetcherException")) { | ||
if (exception.getMessage().equals("A network error occurred")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Of course, please add the strings to the english language resource file. |
||
dialogService.showWarningDialogAndWait(Localization.lang("An error occurred"), | ||
Localization.lang(exception.getMessage() + ". You have no rights to access resources")); | ||
} | ||
} else { | ||
dialogService.showWarningDialogAndWait(Localization.lang("An error occurred"), | ||
Localization.lang(exception.getMessage())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Background information is available at https://devdocs.jabref.org/getting-into-the-code/code-howtos#using-localization-correctly. |
||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
exception instanceof FetcherException
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!