effect
effect copied to clipboard
Add log level option to Effect.ignoreLogged
Summary
The user was looking for a way to ignore errors in JavaScript without doing anything with them. They initially used Effect.catchAll(() => Effect.ignore(Effect.unit)), but were unsure if there was a better way to achieve this. They were specifically interested in logging the errors they were ignoring.
After some discussion, it was suggested to use Effect.ignoreLogged to ignore the errors and log them. However, it seems that Effect.ignoreLogged was not logging the errors as expected. The user then tried using Effect.tapError with Console.log to manually log the errors, which worked for them.
Key takeaways:
- In JavaScript, it is not possible to completely ignore errors without doing anything with them. You need to handle them in some way, even if it means logging them and moving on.
Effect.ignoreLoggedshould log the errors it ignores, but it may not work as expected in some cases. Manually logging the errors usingEffect.tapErrorandConsole.logcan be a workaround.- It's important to consider the logging level when using
Effect.ignoreLogged. Adjusting the minimum log level usingLogger.withMinimumLogLevelcan help ensure that the errors are logged in the desired mode.
Discord thread
https://discord.com/channels/795981131316985866/1167484615804596354
Takeaway: add a log level param to ignoreLogged