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

Merged
ashimokawa merged 3 commits from TaaviE/Gadgetbridge:patch-3 into master 1 week ago
TaaviE commented 2 weeks 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.
ashimokawa commented 1 week ago
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();
TaaviE commented 1 week ago
Poster

Okay, I can log the stacktrace using logger.

Okay, I can log the stacktrace using logger.
TaaviE commented 1 week ago
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.
ashimokawa commented 1 week ago
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); ```
TaaviE commented 1 week ago
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.
ashimokawa commented 1 week ago
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 ;)
ashimokawa commented 1 week ago
Owner

Oh and that “fuck” was pushed by accident. ;)

Oh and that "fuck" was pushed by accident. ;)
TaaviE commented 1 week ago
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?
ashimokawa commented 1 week ago
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. 🍠
TaaviE commented 1 week ago
Poster

I cleaned up the double logging.

I cleaned up the double logging.
ashimokawa merged commit f9dc625c5c into master 1 week ago
ashimokawa commented 1 week ago
Owner

Squashed and merged! Thanks

Squashed and merged! Thanks
TaaviE deleted branch patch-3 1 week 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.