M
M
MIsternik2016-12-22 16:00:56
Java
MIsternik, 2016-12-22 16:00:56

What is the best/correct way to handle exceptions in an android library?

There is a need to implement a library for Andriod that interacts with some api.
The question is how to correctly respond to exceptions thrown both by your own code and by third-party ones?
Is it normal and if so, how to send yourself reports about them?
1. Keep silent about them and return an empty response.
2. Replace exceptions with your own.
3. Do not intercept.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MIsternik, 2016-12-22
@MIsternik

I'll just leave it here http://stackoverflow.com/questions/29533992

R
Rou1997, 2016-12-22
@Rou1997

God forbid I work with a library that was written by a person who does not understand Escobar's axiom!
In this case, if there are no analogues, I just take and do without a library, if possible, I write my own.

M
maaGames, 2016-12-22
@maaGames

Ask yourself three simple questions (the numbers correspond to the points in your question):
1. Does the bug affect the program? (no? Then we pretend that there was no exception)
2. Can you fix the error? (Yes? Then fix it in the exception handler. Replacing the exception with your own, for further processing is also considered)
3. Can you ignore the error? (Yes? Then we pretend that there was no exception)
Otherwise, we display an error message and exit the program, because if the program does not work correctly, there will be less harm if you exit the work than returning / saving garbage.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question