From the course: Coding Exercises: Scala
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Error handling - Scala Tutorial
From the course: Coding Exercises: Scala
Error handling
(bright video game music) - [Instructor] Every programmer has to deal with error handling. In this challenge, we're going to get some practice with error handling in a simplified version of an online store. In the file, 01>_13b.scala, you'll find some methods that sketch out how order fulfillment in an eCommerce store might work. We have methods to get an order, given a user ID, get delivery details, given an order ID and get fulfillment details, given an order and delivery details. Each of these methods can fail. For example, an order might not have any delivery details associated with it. Your task is to implement the method, processOrderForUser. It should get the order for the user ID, get the delivery details for the order if there is an order and get the fulfillment details for the order and delivery details. Each step can fail, so the final result is an option. You should use a for-comprehension to do this. Now…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Palindrome detector2m 15s
-
(Locked)
Password checker4m 20s
-
(Locked)
Colored boxes2m 15s
-
(Locked)
System properties1m 17s
-
(Locked)
Resistor tolerance2m 36s
-
(Locked)
Snakes and camels1m 58s
-
(Locked)
Stuff the stats sheet5m 50s
-
(Locked)
A slice of Pi5m 13s
-
(Locked)
Cron and regular expressions4m 35s
-
(Locked)
Reservoir sampling4m 55s
-
(Locked)
Evaluate a decision tree3m 3s
-
(Locked)
Calculator2m 41s
-
(Locked)
Error handling2m 58s
-
(Locked)
Sierpinski Triangle2m 2s
-
(Locked)
Rocketship7m 16s
-