From ba4ececa1312b6dbaa1afcb51a774cbb637aa39b Mon Sep 17 00:00:00 2001 From: Mark Fredrik Gumban Date: Fri, 31 Jan 2020 00:18:54 +0800 Subject: [PATCH] #1: handle exceptions --- MarkLogicAddIn/DocumentPanelViewModel.cs | 2 +- MarkLogicAddIn/SearchDockPaneViewModel.cs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/MarkLogicAddIn/DocumentPanelViewModel.cs b/MarkLogicAddIn/DocumentPanelViewModel.cs index 156836f..6be4d5f 100644 --- a/MarkLogicAddIn/DocumentPanelViewModel.cs +++ b/MarkLogicAddIn/DocumentPanelViewModel.cs @@ -64,7 +64,7 @@ public async void FetchDocument(ConnectionProfile connProfile, string documentUr DocumentUri = documentUri; FormattedContent = document.RawContent; } - catch (AuthorizationRequiredException e) + catch (Exception e) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.ToString(), "MarkLogic", MessageBoxButton.OK, MessageBoxImage.Error); } diff --git a/MarkLogicAddIn/SearchDockPaneViewModel.cs b/MarkLogicAddIn/SearchDockPaneViewModel.cs index cf8a63a..5877daf 100644 --- a/MarkLogicAddIn/SearchDockPaneViewModel.cs +++ b/MarkLogicAddIn/SearchDockPaneViewModel.cs @@ -160,10 +160,19 @@ private async Task DoValues(SearchQuery query, string searchOptions, strin private async void GetQueryOptions() { if (_queryOptions == null && HasSelectedSearchServiceProfile) - _queryOptions = await SearchService.Instance.ConfigQuery(_conn, SelectedSearchServiceProfile.SearchOptions); - - NotifyPropertyChanged(() => HasQueryOptions); - NotifyPropertyChanged(() => QueryOptions); + { + try + { + _queryOptions = await SearchService.Instance.ConfigQuery(_conn, SelectedSearchServiceProfile.SearchOptions); + NotifyPropertyChanged(() => HasQueryOptions); + NotifyPropertyChanged(() => QueryOptions); + } + catch (Exception e) + { + ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(e.ToString(), "MarkLogic", MessageBoxButton.OK, MessageBoxImage.Error); + } + } + } private void AppendConstraint(object constraintName)