S
S
sys_user2021-06-03 18:27:55
Java
sys_user, 2021-06-03 18:27:55

Why convert different types of exceptions to RuntimeException?

In a project, I often see how various exceptions (not only Exception, but also custom ones) are "converted" into RuntimeException. Why is this being done? Is this the correct approach?

try {
    //some code
} catch (Exception e) {
    throw new RuntimeException(e);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-06-03
@sys_user

Rough kosyl for checked exceptions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question