wangvisual / autoarchive

A Thunderbird extension that can move or archive your mails based on rules.
GNU General Public License v3.0
41 stars 13 forks source link

BUG: Exception on no longer existent account/folder #10

Closed rerecrose closed 10 years ago

rerecrose commented 10 years ago

BUG: Exception on no longer existent account/folder

How to reproduce: Create a test account in TB.

Create a rule to work with contents in the INBOX inside that account/folder

-Delete the account.

Upon automated run there will be an exception caught

Suggestion: Check for existence of the account/virtual-folder before working on it

Thank you as always.

Incredible the great work you are doing. Your are marking the difference. This is putting and end to arguments and concerns from many OL users to Finally migrate to TB.

wangvisual commented 10 years ago

There was check for the folders: try { srcFolder = MailUtils.getFolderForURI(rule.src); if ( ["move", "copy"].indexOf(rule.action) >= 0 ) { destFolder = MailUtils.getFolderForURI(rule.dest); self.wait4Folders[rule.dest] = self.accessedFolders[rule.dest] = true; } else rule.dest = ''; } catch (err) { autoArchiveLog.logException(err); }

How is the exception looks like? if it's was with a popup window at bottom right screen, then it was the one 'autoArchiveLog.logException(err);'

Thanks for reporting bugs, it helps me a lot.

rerecrose commented 10 years ago

Yes it's not crashing TB, and it's NOT an unhandled exception I think it's your exception handler executing.

Regarding this issue: You are a prudent coder and you embrace the practice of putting critical/delicate operations in exception try/catch structures.

However, I'm of the opinion that well known and easily reproducible errors should be detected before the last-resort exception catch.

I like the world of C and C++ and I prefer not to trigger exceptions if other error capture mechanisms are available and they can prevent falling down to the exception capture and processing system. (You know: Good exception catching and posterior handling can be a very picky and complex thing and resource leakage or unexpected behaviours may occur under certain circumstances) However, exceptions are nice last resort for handling unknown bugs, errors and absolutely unexpected conditions

In other words : It's nice to have good airbags in the car, but better if a good braking system can prevent ever using the airbags. But the airbags also need to be there in a good design.

I don't have good knowledge of TB API or its Component Obj Model (yet) so I don't know whether there is a test for checking for "folder existence/validity" that can be done without triggering a exception. Anyway in case of bad/Non longer existing folders a message/dialog could be used to notify the user about this problem and the offending rule could be coloured in Red in the config dialog... "Awsome Autoarchiver: Archie says: Please check Your rules... it seems there is an error", etc

Also the exception catching window closes too fast to read msgs and codes. I would like it to remain a little longer.

Thanks again to you for the lighting-speed responses and improvements!

wangvisual commented 10 years ago

Thanks for the explanation and I agree that we should prevent the error as early as possible, actually in version 0.3 the rule dialog already indicate the user if the folder is not exits clipboard01

However, due to TB user can edit the rule without the dialog ( technically ), so the last-resort exception capture should be there to prevent issues.

rerecrose commented 10 years ago

Absolutely agree, Exception handling MUST ALWAYS be kept as an additional safety and security system. As I said: "But the airbags also need to be there in a good design." :)

The user could also just delete the folder or the entire TB account and that would also lead to the error condition or exception

Thanks

wangvisual commented 10 years ago

"Also the exception catching window closes too fast to read msgs and codes. I would like it to remain a little longer." It's hard coded as 4 seconds by TB, I can use my own method to show the alert window, or I need try to see if I can override to another value.

Anyway, if you found some error and can't catch it because it close, you can open 'error console' and check what happens.

rerecrose commented 10 years ago

I need to increase my TB console logging and displaying depth. it's too short (Easily overwhelmed due to multiple msgs)

Perhaps there is (or hopefully there will be in the future) some "TB config registry" settings for these things: exception dialog time and console settings somewhere?

I would like something as: devtools.errorconsole.LogDepth = ... etc

:)

wangvisual commented 10 years ago

The 'new email popup' has internal config to change the show time, but not this popup alert. I can change it soon.

For the error console, it's obsoleted by 'browser console' in Firefox, don't know if the new 'browser console' will be ported to TB or not.