Troubleshooting Error Handling and Logging in Effect-based Program

Hey i just started with effect and i have the problem that my programm does not seem to recognise the errors and also it does not log "Login successful" when it is:
import Mailjs from '@cemalgnlts/mailjs';
import {Data, Effect, pipe} from 'effect';

class CreateAccountError extends Data.TaggedError("CreateAccountError")<{ message: string }> {
}
class LoginError extends Data.TaggedError("LoginError")<{ message: string }> {
}

const mailjs = new Mailjs();

const createAnAccount = pipe(
        Effect.tryPromise(() => mailjs.createOneAccount()),
        Effect.flatMap((response) => {
            if (!response.status) {
                Effect.fail(new CreateAccountError({message: response.message}));
            }
            const {username, password} = response.data;

            return Effect.tryPromise(() => mailjs.login("username", password));
        }),
        Effect.tap((response) => {
            if (response.status) {
                Effect.log('Login successful');
            } else {
                Effect.fail(new LoginError({message: response.message}));
            }
        }),
)

Effect.runPromise(createAnAccount).then(console.log)
Was this page helpful?