Refactoring Error Handling in Effect Pipe

Hm.. I'd like to pull out tapErrorTag and mapError in pipe to be reusable and generic over Effect<unknown, UnknownException, unknown>, but not sure how to go about this?

    return response.pipe(
      Effect.tapErrorTag("UnknownException", Effect.logError),
      Effect.mapError((error) =>
        InternalError.make({
          code: "internal",
        })
      ),
    );
Was this page helpful?