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

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…

Contents