Questions in java exception handling throw and try-catch

I was wondering when I was doing Java, so I made a note as a record (..) φ

When considering a program that processes in three layers

When catching an Exception that occurred in the bottom refurbishment at the top level,

I thought I had to throw to the upper hierarchy in the middle hierarchy,

図1.png

It looks like it wasn't necessary ...

Actually, it seems that you can go as shown in the figure below

図2.png

I think everyone knows it, but ...

Specifically, in a 3-layer client system,

When handling various errors in the presentation layer, the application layer detects the errors that occur in the data layer. Do I have to throw it? It was that.

Recommended Posts

Questions in java exception handling throw and try-catch
[Java] About try-catch exception handling
Exception handling techniques in Java
Java exception handling?
[Java] Exception handling
☾ Java / Exception handling
Java exception handling
Java exception handling
[java] throw an exception
[Java Silver] (Exception handling) About try-catch-finally and try-with-resource statements
[Java] Practice of exception handling [Exception]
[Ruby] Exception handling in functions
Java exception handling usage rules
Error logging and exception handling that you can't often see in the Java area
Encoding and Decoding example in Java
[In-house study session] Java exception handling (2017/04/26)
StringBuffer and StringBuilder Class in Java
Understanding equals and hashCode in Java
Step-by-step understanding of Java exception handling
[For Java beginners] About exception handling
[Java] Exception types and basic processing
Hello world in Java and Gradle
[Introduction to Java] About exception handling (try-catch-finally, checked exception, unchecked exception, throws, throw)
Leverage Either for individual exception handling in the Java Stream API
Difference between final and Immutable in Java
[Java] for Each and sorted in Lambda
Top 75+ JSP Interview Questions and Answers In 2020
Exception handling
Arrylist and linked list difference in java
Program PDF headers and footers in Java
Learn Flyweight patterns and ConcurrentHashMap in Java
Java Direction in C ++ Design and Evolution
Java to C and C to Java in Android Studio
Reading and writing gzip files in Java
Difference between int and Integer in Java
Exception handling Exception
Discrimination of Enums in Java 7 and above
try-catch-finally exception handling How to use java
Create barcodes and QR codes in Java PDF
[Java] Handling of JavaBeans in the method chain
Detect similar videos in Java and OpenCV rev.2
[ev3 × Java] Interface, implementation and inheritance (event handling)
Parallel and parallel processing in various languages (Java edition)
Difference between next () and nextLine () in Java Scanner
Differences in writing Java, C # and Javascript classes
Capture and save from selenium installation in Java
Detect similar videos in Java and OpenCV rev.3
[Java] Understand in 10 minutes! Associative array and HashMap
Basics of threads and Callable in Java [Beginner]
Java adds and removes watermarks in word documents
Detect similar videos in Java and OpenCV rev.1
Represents "next day" and "previous day" in Java / Android
Upload and download notes in java on S3
Encrypt / decrypt with AES256 in PHP and Java
Generate OffsetDateTime from Clock and LocalDateTime in Java
About exception handling
ruby exception handling
Partization in Java
Changes in Java 11
Rock-paper-scissors in Java
Ruby exception handling