AdvancedBan icon indicating copy to clipboard operation
AdvancedBan copied to clipboard

Better exception handling practices

Open A248 opened this issue 5 years ago • 0 comments

Exception handling and control flow

There are numerous cases where AdvancedBan prints the exception message or prints the stacktrace of an exception, then continues along. The problem with this approach is it leaves AdvancedBan teetering on in a half-failed state. It would be better to let the exception propagate.

The latest.log

AdvancedBan creates its own latest.log file and prints messages to it. This file is unintuitive to users, and results in more time spent in support. It means we have to ask for users to look in their plugins directory when the information would have been easily accessible in the server log.

The server console exists for a reason; it doesn't make sense for plugins to have their own log files. That just makes it harder for support and debugging. If there is an issue with AdvancedBan, it should be easy to debug, both for the user and for support helpers.

Summary

Exceptions should not be hidden, suppressed, or partially logged. They should be allowed to signal the problem as clearly as possible, so that the bug can be more quickly solve. They should not be hidden away in a plugin-specific log file and they should be rethrown in most cases rather than logged.

A248 avatar Nov 12 '20 01:11 A248