Skip to content

Fix EXO connection error handling for MSAL auth failures#300

Open
T0pCyber wants to merge 1 commit intoDevelopmentfrom
claude/test-pat-integration-2DH9k
Open

Fix EXO connection error handling for MSAL auth failures#300
T0pCyber wants to merge 1 commit intoDevelopmentfrom
claude/test-pat-integration-2DH9k

Conversation

@T0pCyber
Copy link
Copy Markdown
Owner

@T0pCyber T0pCyber commented Mar 9, 2026

Summary

  • Fixes Test-EXOConnection to catch all exceptions from Get-OrganizationConfig, not just CommandNotFoundException — this handles expired/stale sessions that previously fell through silently
  • Wraps Connect-ExchangeOnline with error handling and a single retry for transient MSAL token acquisition errors (MsalServiceException)
  • Provides a clear error message with the manual workaround if both connection attempts fail

Problem

Users reported unhandled MsalServiceException crashes when Hawk auto-connected to Exchange Online (see #287). The root cause was that Test-EXOConnection only caught CommandNotFoundException, leaving MSAL authentication errors and stale session failures completely unhandled.

Test plan

  • Verify normal EXO connection flow still works when already connected
  • Verify auto-connection works when not yet connected
  • Verify retry logic handles transient MSAL failures gracefully
  • Verify clear error message is shown when both attempts fail

Closes #287

https://claude.ai/code/session_01BnFujty83uF1tyubTjtmx4

Test-EXOConnection previously only caught CommandNotFoundException,
missing MSAL token acquisition errors (MsalServiceException) and
stale/expired session failures. This caused unhandled crashes when
Hawk auto-connected to Exchange Online (issue #287).

Changes:
- Catch all exceptions from Get-OrganizationConfig, not just
  CommandNotFoundException, to handle expired sessions
- Wrap Connect-ExchangeOnline with error handling and a single retry
  for transient MSAL errors
- Provide a clear error message with manual workaround if both
  connection attempts fail

Closes #287

https://claude.ai/code/session_01BnFujty83uF1tyubTjtmx4
@T0pCyber T0pCyber changed the base branch from master to Development March 9, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question: Unexpected Error on User Investigation

2 participants