Skip to content

Commit 3aca9b5

Browse files
Let us know when the My Details page can’t be loaded
Refs #3188
1 parent 85af90f commit 3aca9b5

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/WebApp/Router/NonEffectRouter/MyDetailsRouter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ export const MyDetailsRouter = pipe(
477477
),
478478
TE.mapLeft(() => 'unavailable' as const),
479479
),
480+
...env.logger,
480481
}),
481482
),
482483
) satisfies P.Parser<(env: Env) => T.Task<Response.Response>>

src/WebApp/my-details-page/my-details.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Option, pipe } from 'effect'
22
import { format } from 'fp-ts-routing'
33
import * as RTE from 'fp-ts/lib/ReaderTaskEither.js'
4+
import * as L from 'logger-fp-ts'
45
import { match, P } from 'ts-pattern'
56
import { maybeGetAvatar } from '../../avatar.ts'
67
import { maybeGetCareerStage } from '../../career-stage.ts'
@@ -49,6 +50,11 @@ export const myDetails = ({ locale, user }: { locale: SupportedLocale; user?: Us
4950
? RTE.of(undefined)
5051
: saveUserOnboarding(publicPersona.orcidId, { seenMyDetailsPage: true }),
5152
),
53+
RTE.orElseFirstW(error =>
54+
error === 'no-session'
55+
? RTE.of(undefined)
56+
: RTE.rightReaderIO(pipe({ error: error as never }, L.errorP('Unable load My Details page'))),
57+
),
5258
RTE.match(
5359
error =>
5460
match(error)

0 commit comments

Comments
 (0)