Printed a few rather fatal exceptions in case they happen for easier debugging #1946

Merged
ashimokawa merged 3 commits from TaaviE/Gadgetbridge:patch-3 into master 11 months ago
TaaviE commented 11 months ago

Exceptions in this code are usually with rather severe consequences, I think it would be better if they were printed for ease of debugging.

Exceptions in this code are usually with rather severe consequences, I think it would be better if they were printed for ease of debugging.
Owner

We use our logger for that else they wont go to logfiles - only logcat.
So we never use e.printStackTrace();

We use our logger for that else they wont go to logfiles - only logcat. So we never use e.printStackTrace();
Poster

Okay, I can log the stacktrace using logger.

Okay, I can log the stacktrace using logger.
Poster

@ashimokawa I switched to using the logger and added it to a few more places where it would be useful to have a stacktrace.

@ashimokawa I switched to using the logger and added it to a few more places where it would be useful to have a stacktrace.
Owner

@TaaviE

most of this is unneccessary, logging stacktraces worrks like this:

LOG.error("Error accessing database", e);
@TaaviE most of this is unneccessary, logging stacktraces worrks like this: ``` LOG.error("Error accessing database", e); ```
Poster

logging stacktraces worrks like this:

Good to know, fixed it 😅.

I also extracted the strings displayed to the users in the toasts.

> logging stacktraces worrks like this: Good to know, fixed it 😅. I also extracted the strings displayed to the users in the toasts.
Owner

@TaaviE

Looks better, however, IIRC, the toast when given an exception also logs that, so with the toast you not have to use LOG afterwards.

Need to check that claim myself, but this is what I remember ;)

@TaaviE Looks better, however, IIRC, the toast when given an exception also logs that, so with the toast you not have to use LOG afterwards. Need to check that claim myself, but this is what I remember ;)
Owner

Oh and that "fuck" was pushed by accident. ;)

Oh and that "fuck" was pushed by accident. ;)
Poster

Looks better, however, IIRC, the toast when given an exception also logs that, so with the toast you not have to use LOG afterwards.

Someone might remove the toast in the future but the error should still be logged, it's a tad clearer what a function does and I think double logging isn't that awful in that one instance?

> Looks better, however, IIRC, the toast when given an exception also logs that, so with the toast you not have to use LOG afterwards. Someone might remove the toast in the future but the error should still be logged, it's a tad clearer what a function does and I think double logging isn't that awful in that one instance?
Owner

Someone might remove the toast in the future but the error should still be logged, it's a tad clearer what a function does and I think double logging isn't that awful in that one instance?

Hmm, having the optional parameter with the exception in the toast call means log that. One has to know. Double logging is not exceptionally bad but still unneccessary IMO. 🍠

> Someone might remove the toast in the future but the error should still be logged, it's a tad clearer what a function does and I think double logging isn't that awful in that one instance? Hmm, having the optional parameter with the exception in the toast call *means* log that. One has to know. Double logging is not exceptionally bad but still unneccessary IMO. 🍠
Poster

I cleaned up the double logging.

I cleaned up the double logging.
ashimokawa merged commit f9dc625c5c into master 11 months ago
Owner

Squashed and merged! Thanks

Squashed and merged! Thanks
TaaviE deleted branch patch-3 11 months ago
The pull request has been merged as f9dc625c5c.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.