Advanced Exception Handling in Java

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Today I would like to show you how to properly handle exceptions in Java. Most books about programming don’t really explain exception handling. It seems like exception handling is just some nasty cleanup stuff and you would just see some auto-generated exception handling code with printStackTrace because exception handling is just in the way of the real topic and I really think that exception handling is a very important topic that only a few developers properly can do...

MarcusBiel
Автор

Very good content! I work as an software engineer for a big public company and i see many similarities about logging and handling exceptions in my work..

PLanBBeaTZ
Автор

Super duper good content!! very helpful. thank you!

DanielHai-owkm
Автор

3:19 printStackTrace() is problematic, it collects the whole stack and takes lots of memory
3:43 best way of handling Exception
4:40 handle it as early as possible
7:38 another way of handling checked Exception
9:40 never do log and then rethrow

ruixue
Автор

A few suggestions:
- The last bit discussing logging and log levels, while valid, has nothing to do with exception handling. Should perhaps split that out into a separate video.
- Catching RuntimeException is almost as bad as catching Exception. I know this is just a simple example, but it goes against the rule of always catching the most specific exception class.
- Discussion of the finally block is missing.
- Should add discussion about try-with-resources.

ropro
Автор

Another think, switching from LOG.error to LOG.warn could cause to lose visibility/priority in frameworks like "hadoop" used for analyze log files.

leonardogutierrez
Автор

Very good job..
Pls, pay attention to your coding style... mailing when it deals about spacing. it makes obsessive people like me get desperate. =)
Joking.

Автор

I don't like "e" for the exception name in the catch blocks, I think you could have chosen "ex", it is way better than "e"(I usually see for (Type e : elements ... ) <- in this case "e" is good to represent that it is an "element" from "elements").

leonardogutierrez