ericcornelissen / NervousFish

An app for your :iphone: to exchange public-keys in a secure manner.
GNU Lesser General Public License v3.0
2 stars 4 forks source link

Use the SLF4J to log errors in try-catch blocks #108

Closed ericcornelissen closed 7 years ago

ericcornelissen commented 7 years ago

What

Replace all instance of e.printStackTrace() by LOGGER.error("message", e);. This PR is in response to a comment by @TheBonheurs about the use of e.printStackTrace() in MainActivity.java.

Why

To improve the usage of the logging facilities and make it easier to debug. Even though e.printStackTrace() provides some info, LOGGER.error("message", e); provides more specific info and (can) also log to a file.

How

As you can see in commit 8282c1b PMD should now complain if e.printStackTrace() is used. If you still have your doubts you can use Ctrl + Shift + f (in Android studio) to search the whole project for "printStackTrace".

Alternative implementation

Non.

Notes

n/a

ericcornelissen commented 7 years ago

That question should have been raised before 😅 Anyhow, in most cases you can (one way or another) force the exception to show up... But that is not wat this PR is about imo