Challenge 1: Eliminate Exceptions Using the Either Monad

Test your knowledge by rewriting the given code without using any exceptions.

A code snippet is given below. It has an authenticateUser function that authenticates the provided username and password with the stored username and password. If authentication fails, the program throws an exception.

Get hands-on with 1200+ tech skills courses.