await Effect.forEach(
options.guards || [ctx.auth.defaultGuard],
(guard) =>
new NotGuestUserException().pipe(
Effect.whenEffect(
Effect.tryPromise({
try: async () => await ctx.auth.use(guard).check(),
catch: (err) => new InternalServerException({ error: err }, 'Unexpected error while checking the authentication status'),
})
)
),
{ discard: true }
).pipe(executePromiseEffect)
// without effect
for (let guard of options.guards || [ctx.auth.defaultGuard]) {
if (await ctx.auth.use(guard).check()) {
throw new NotGuestUserException()
}
}
await Effect.forEach(
options.guards || [ctx.auth.defaultGuard],
(guard) =>
new NotGuestUserException().pipe(
Effect.whenEffect(
Effect.tryPromise({
try: async () => await ctx.auth.use(guard).check(),
catch: (err) => new InternalServerException({ error: err }, 'Unexpected error while checking the authentication status'),
})
)
),
{ discard: true }
).pipe(executePromiseEffect)
// without effect
for (let guard of options.guards || [ctx.auth.defaultGuard]) {
if (await ctx.auth.use(guard).check()) {
throw new NotGuestUserException()
}
}