课程: Java Exception Handling

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Challenge: Catch and handle two exceptions

Challenge: Catch and handle two exceptions - Java教程

课程: Java Exception Handling

Challenge: Catch and handle two exceptions

(upbeat music) - [Instructor] So far in this course, we have learned about throwables, exceptions, and how to throw and catch these exceptions. In this challenge, we will update the rest of our code to handle catching two other exceptions. In our controller, we have two endpoints that currently throw exceptions. First, on line 23 for the fine number endpoint, where a Fibonacci out of range exception is thrown. This is because the user is providing a number that is too high for the app to handle and could potentially result in a stack overflow error due to the simple recursive approach that we are using to find the Fibonacci sequence. You can take a look at that in our Fibonacci method. This is on line 106 in our controller. The second endpoint that is throwing an exception is found on line 34 for our create sequence endpoint, which throws an IO exception, whenever an exception arises while storing a generated…

内容