Skip to content

Handle management/info failures gracefully in ProfileService#789

Merged
krusche merged 1 commit into
developfrom
fix/profile-service-graceful-error
Jun 17, 2026
Merged

Handle management/info failures gracefully in ProfileService#789
krusche merged 1 commit into
developfrom
fix/profile-service-graceful-error

Conversation

@krusche

@krusche krusche commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

ProfileService.getProfileInfo() fetched /management/info with no error handling. When that request fails or returns a non-JSON body (e.g. the backend is unreachable, or the SPA is served standalone), the error propagated uncaught to every subscriber — navbar, footer, page-ribbon, create-simulation-box — and each surfaced in Angular's global ErrorHandler. On the anonymous landing page that's 3 active subscribers ⇒ 3 console errors.

This mirrors the resilience AccountService.identity() already has (catchError(() => of(undefined))): on failure, degrade gracefully to a default ProfileInfo instead of throwing.

.pipe(
  map(...),
  catchError(() => of(new ProfileInfo())), // <- added
  shareReplay(),
)

Context

This surfaced while smoke-testing the Angular 22 PR (#784) by serving the production bundle without a backend: the 3 console errors were all from this missing catchError (the /api/account 401 path was already handled). It is pre-existing and unrelated to the Angular version — in normal deployments /management/info returns JSON, so it never fired. The fix makes the app robust when it doesn't.

Testing

  • Production build (pnpm run webapp:prod) ✅
  • Served the prod bundle and loaded it in a browser with no backend: 0 console errors (was 3); navbar/footer/landing render unchanged.
  • pnpm run lint ✅ · pnpm run prettier:check

🤖 Generated with Claude Code

getProfileInfo() had no error handling, so a failed /management/info request
(e.g. backend unreachable) propagated uncaught to every subscriber (navbar,
footer, page-ribbon, create-simulation-box) and surfaced as multiple errors in
the global Angular ErrorHandler. Mirror the resilience already present in
AccountService by catching the error and degrading to default ProfileInfo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 17, 2026 06:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@krusche krusche merged commit 3523aef into develop Jun 17, 2026
1 check passed
@krusche krusche deleted the fix/profile-service-graceful-error branch June 17, 2026 06:25
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