Skip to content

Prevent crashes and log errors if docs can't be found.#3689

Merged
llimeht merged 3 commits intoSasView:mainfrom
llimeht:tmp/protect-doc-finding
Nov 7, 2025
Merged

Prevent crashes and log errors if docs can't be found.#3689
llimeht merged 3 commits intoSasView:mainfrom
llimeht:tmp/protect-doc-finding

Conversation

@llimeht
Copy link
Copy Markdown
Contributor

@llimeht llimeht commented Nov 6, 2025

Description

Calculating the location of the docs at runtime can generate exceptions if the docs can't be found. They should never not be found, of course, ... but....

Given that development environments are probably the most likely to have this broken and contributor camp is looming, this is a quick and urgent fix to make sure that new contributors don't end up yak-shaving their development environment more than needed.

The commits here:

  1. prevent crash on startup if the docs can't be found to be copied around; logging an error if this happens
  2. drop an unused _tutorialLocation member that would lead to a crash on startup
  3. protect other places the help system is started, having them log an error rather than dump a backtrace to console; these don't actually cause sasview to crash, they are just ugly for the user

How Has This Been Tested?

  1. Start sasview and test that view docs still works from both FitPage and Help menu
  2. Make loading docs fail by either editing the "docs" entries in sas/system/user.py or by deleting them (from dist-packages/sas if you are working in an editable install as recommended)
  3. start sasview, see a log entry on startup and log entries when you attempt to view docs:
ERROR : sas.system.user (user.py:196) :: Documentation could not be found! Help documentation will not be available in SasView.
ERROR : sas.qtgui.Perspectives.Fitting.FittingWidget (FittingWidget.py:1666) :: Help documentation was not found.
ERROR : sas.qtgui.MainWindow.GuiManager (GuiManager.py:361) :: Help documentation was not found.

Review Checklist:

[if using the editor, use [x] in place of [ ] to check a box]

Documentation (check at least one)

  • There is nothing that needs documenting
  • Documentation changes are in this PR
  • There is an issue open for the documentation (link?)

Installers

  • There is a chance this will affect the installers, if so
    • Windows installer (GH artifact) has been tested (installed and worked)
    • MacOSX installer (GH artifact) has been tested (installed and worked)
    • Wheels installer (GH artifact) has been tested (installed and worked)

Licensing (untick if necessary)

  • The introduced changes comply with SasView license (BSD 3-Clause)

Render the documentation system inactive rather than crashing when the docs can't be located
@llimeht llimeht requested a review from DrPaulSharp November 6, 2025 23:26
@llimeht llimeht added the Critical High priority label Nov 6, 2025
Copy link
Copy Markdown
Contributor

@DrPaulSharp DrPaulSharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as expected.

@llimeht llimeht merged commit b9bbb24 into SasView:main Nov 7, 2025
15 checks passed
@llimeht llimeht deleted the tmp/protect-doc-finding branch November 7, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical High priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants