Handling All Errors and Defects in Effect with Exhaustive Matching

What is the right way in effect to force you to deal with all the different errors, I'm looking for something like Match.exhaustive that will force me to work through all the errors including defects. Right now I have code like this:
return await Effect.gen(function* () {
  yield* onSubmit(value.otp)
  yield* Effect.sync(() => onSuccess())
}).pipe(
  Effect.catchTags({
    OTPVerificationError: (error) =>
      Effect.succeed({
        fields: {
          otp: error.message,
        },
      }),
  }),
  Effect.catchAllDefect(() =>
    Effect.succeed({
      fields: {
        otp: 'Something went wrong',
      },
    }),
  ),
  Effect.runPromise,
)
Was this page helpful?