Skip to content

Commit b837506

Browse files
committed
Add employee Izumi to the error handling section
The exercises assume there is an employee named `Izumi`, but the functions do not have such a case
1 parent fe88dcc commit b837506

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/scala/fpinscalalib/ErrorHandlingSection.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ object ErrorHandlingSection
4747
*/
4848
def optionMapAssert(res0: (Option[Employee]) => Option[String]): Unit = {
4949
def lookupByName(name: String): Option[Employee] = name match {
50-
case "Joe" => Some(Employee("Joe", "Finances", Some("Julie")))
51-
case "Mary" => Some(Employee("Mary", "IT", None))
52-
case _ => None
50+
case "Joe" => Some(Employee("Joe", "Finances", Some("Julie")))
51+
case "Mary" => Some(Employee("Mary", "IT", None))
52+
case "Izumi" => Some(Employee("Izumi", "IT", Some("Mary")))
53+
case _ => None
5354
}
5455

5556
/**
@@ -244,9 +245,10 @@ object ErrorHandlingSection
244245
*/
245246
def eitherMapAssert(res0: (Either[String, Employee]) => Either[String, String]): Unit = {
246247
def lookupByNameViaEither(name: String): Either[String, Employee] = name match {
247-
case "Joe" => Right(Employee("Joe", "Finances", Some("Julie")))
248-
case "Mary" => Right(Employee("Mary", "IT", None))
249-
case _ => Left("Employee not found")
248+
case "Joe" => Right(Employee("Joe", "Finances", Some("Julie")))
249+
case "Mary" => Right(Employee("Mary", "IT", None))
250+
case "Izumi" => Right(Employee("Izumi", "IT", Some("Mary")))
251+
case _ => Left("Employee not found")
250252
}
251253

252254
def getDepartment: (Either[String, Employee]) => Either[String, String] = res0

0 commit comments

Comments
 (0)