Help Needed: Mapping and Transforming Auth Errors in Code
Hey Guys,
I have following code, and want to map authErrors than might be returned by above methods, and want to transform it to response
Can you help me figure that out, please?
const processingGenerator = Effect.gen(function() {
const authorizer = yield AuthorizerFactory.getInstance(request, env)
const userData = yield* AuthorizationService.authorize(authorizer)
const response = yield* fetchUnderlyingResource(userData)
return SecurityFilter.modifyResponse(response,env)
}).pipe(
//FIXME I want to map authErrors than might be returned by above methods, and want to transform it to response
Effect.catchSome( (authError) =>
Effect.succeed(authError.toResponse())
))
return Effect.runPromise(processingGenerator)
I have following code, and want to map authErrors than might be returned by above methods, and want to transform it to response
Can you help me figure that out, please?
const processingGenerator = Effect.gen(function() {
const authorizer = yield AuthorizerFactory.getInstance(request, env)
const userData = yield* AuthorizationService.authorize(authorizer)
const response = yield* fetchUnderlyingResource(userData)
return SecurityFilter.modifyResponse(response,env)
}).pipe(
//FIXME I want to map authErrors than might be returned by above methods, and want to transform it to response
Effect.catchSome( (authError) =>
Effect.succeed(authError.toResponse())
))
return Effect.runPromise(processingGenerator)
