Skip to content

fix: route collab error map messages to appropriate console levels#948

Merged
kptdobe merged 1 commit into
mainfrom
errormap
May 20, 2026
Merged

fix: route collab error map messages to appropriate console levels#948
kptdobe merged 1 commit into
mainfrom
errormap

Conversation

@kptdobe
Copy link
Copy Markdown
Contributor

@kptdobe kptdobe commented May 20, 2026

Summary

  • 401 messages → console.warn (auth info, not an error)
  • 403 messages → console.log (permission info, not an error)
  • All other messages → console.error with errorMap.toJSON() payload for full context
  • Message is read from errorMap.get('message'), falling back to JSON.stringify(errorMap.toJSON()) when no message key is set

This aligns with adobe/da-collab#157 - no need for an ugly error message in case of an expired token (403). 401 is more unexpected (some removed author full access to the file ?) but still warning is enough.

If message received is 403: sign up popup appears. If author signs in, latest changes are even restored and persisted
If message received is 401: redirected to the 404 page.

Test plan

  • Routes 401 messages to console.warn — verifies warn path and message prefix
  • Routes 403 messages to console.log — verifies log path and message prefix
  • Routes other messages to console.error with toJSON payload — verifies error path + payload
  • Clears the error map after logging — verifies errorMap.clear() is always called
  • Falls back to JSON when no message key is set — verifies fallback serialisation

🤖 Generated with Claude Code

Routes 401 to console.warn, 403 to console.log, and everything else to
console.error with the full errorMap.toJSON() payload. Adds unit tests
covering all branches and the map-cleared-after-logging invariant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented May 20, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@kptdobe kptdobe requested a review from chrischrischris May 20, 2026 08:13
@kptdobe kptdobe merged commit dc2ae6a into main May 20, 2026
4 checks passed
@kptdobe kptdobe deleted the errormap branch May 20, 2026 13:48
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.

2 participants