今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Handle potential runtime exceptions
(upbeat music) - [Instructor] For this challenge, you were tasked with updating any parts of a controller that can encounter an exception. You were to catch these generic exceptions and returning more helpful message to our users. There are a total of four endpoints in our app. We already worked through an example with the findNumber endpoint on line 24. This means you have three endpoints left, that could be updated. Simply put, we could just add this exception catch clause, between line 31 and 34, to any of the existing try-catches that we have, and if a try-catch does not already exist, we can just create one specifically. So to not reinvent the wheel, I'm going to copy lines 31 through 34 and find our next try-catch. So if you recall before, I said handling an NPE like this is not ideal. So I'm actually going to get rid of lines 51 through 54, for createSequence endpoint. And instead use this exception,…
内容
-
-
-
-
-
(已锁定)
What are runtime exceptions?2 分钟 28 秒
-
(已锁定)
Runtime exception: Return NumberFormatException to user9 分钟 25 秒
-
(已锁定)
Challenge: Handle an ArithmeticException3 分钟 59 秒
-
(已锁定)
Solution: Handle an ArithmeticException3 分钟 18 秒
-
(已锁定)
Runtime exception: Handling of NullPointerException6 分钟 16 秒
-
(已锁定)
Runtime exception: Unknown runtime exception4 分钟 18 秒
-
(已锁定)
Challenge: Handle potential runtime exceptions1 分钟 19 秒
-
(已锁定)
Solution: Handle potential runtime exceptions4 分钟 1 秒
-
(已锁定)
-