Seeking Advice on Using `Effect.tapError` for Error Handling

Hi everyone! Effect newbie here.
Although it requires extra effort for those not used to the functional style, I'm already in love with the mental model.
Also, big thanks to @whatplan and @schickling for your videos. Super clear explanations.

I'm trying to achieve the following tasks:
- uploadFile to S3
- postFont metadata to DB
-- In case this fails: removeFile from S3 and return the postFont error.

Is it a good practice to achieve this using Effect.tapError.
Judging the return type, it seems I'm achieving what I want.
But in the docs,
tap
seems to be used exclusively for logging.

This is my code:
const uploadedFont = yield* postFont(font).pipe(
  Effect.tapError(() => removeFile(filekey))
);
Was this page helpful?