Skip to content

Commit 2cb7a9c

Browse files
authored
Merge pull request #3 from cloudroesen/master
Add display actual error message
2 parents 747bcf6 + c13b802 commit 2cb7a9c

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

gui.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -432,17 +432,25 @@ def click_button_fetch() -> None:
432432

433433
if messagebox.askquestion("Fetch CRMScripts", question) == "yes":
434434
fetch = Fetch(tenant)
435-
fetch_success: bool = fetch.fetch()
435+
436+
try:
437+
fetch_success: bool = fetch.fetch()
438+
439+
if fetch.crmscript_version and fetch.crmscript_version < CURRENT_CRMSCRIPT_VERSION:
440+
messagebox.showinfo("CRMScript version",
441+
"The fetcher CRMScript in use is not of the latest version.\n"
442+
"Updating the script is recommended.")
443+
444+
if fetch_success:
445+
messagebox.showinfo("Success", "Fetch successful!")
446+
else:
447+
error_message = getattr(fetch, "last_error", "Unknown error occurred.")
448+
messagebox.showerror("Error", f"Could not fetch data from tenant.\n\nError: {error_message}")
449+
450+
except Exception as e:
451+
messagebox.showerror("Error", f"An unexpected error occurred while fetching:\n{str(e)}")
436452

437-
if fetch.crmscript_version and fetch.crmscript_version < CURRENT_CRMSCRIPT_VERSION:
438-
messagebox.showinfo("CRMScript version",
439-
"The fetcher CRMScript in use is not of the latest version.\n"
440-
"Updating the script is recommended.")
441453

442-
if fetch_success:
443-
messagebox.showinfo("Success", "Fetch successful!")
444-
else:
445-
messagebox.showerror("Error", "Could not fetch data from tenant.")
446454

447455
@staticmethod
448456
def click_button_open_file_explorer():

0 commit comments

Comments
 (0)