PhonologicalCorpusTools / CorpusTools

Phonological CorpusTools
http://phonologicalcorpustools.github.io/CorpusTools/
GNU General Public License v3.0
111 stars 16 forks source link

Bug Reporting #494

Open kchall opened 8 years ago

kchall commented 8 years ago

When bugs arise, add an option to actually send us a bug report with information on what went wrong (e-mail? webpage that hosts the reports?).

bhallen commented 8 years ago

I just did some poking around, and I wasn't able to find any off-the-shelf solutions to this problem. It does seem feasible to use email, though. I've pasted a basic script that does this below. The big hitch is that the script needs to include log-in credentials, so we'd need to figure out a way to hide those.

import smtplib

fromaddr = "arbitraryaddress@somewhere.com" toaddrs = ["addressthatcollectsbugs@somewhere.com"]

msg = 'test message'

server = smtplib.SMTP('smtp.gmail.com', port=587) server.ehlo() server.starttls() server.ehlo() server.login('yourgmailaccount@somewhere.com', 'yourpassword') server.sendmail(fromaddr, toaddrs, msg) server.quit()

devyn commented 8 years ago

It looks like if we want to be sure that bugs/exceptions are caught in worker threads, we'll need to have subclasses of FunctionWorker implement a method other than run() -- perhaps process()?

run() can then pseudo-be:

class FunctionWorker:
    def run(self):
        try:
            self.process()
        except:
            # report the exception
bhallen commented 8 years ago

@devyn It looks like the current solution is to have a bunch of checks like this in the Workers which use the emit method to (I assume) pass the Exception on to the main thread:

except PCTError as e:
    self.errorEncountered.emit(e)
    return
except Exception as e:
    e = PCTPythonError(e)
    self.errorEncountered.emit(e)
    return

Your solution looks like it might be more general, though. Is that right?

bhallen commented 8 years ago

re the original issue (getting PCT to report bugs to us):

I just pushed a commit that adds basic bug reporting. It sends traceback and system info as an email from/to the account pctbugs@gmail.com . Right now there are two major elements lacking in the implementation:

mmcauliffe commented 8 years ago

Versioning is in __init__.py of corpustools, so if you do:

import corpustools

print(corpustools.__version__)

That'll spit out '1.1.1' or whatever version we're up to now. It doesn't know master/dev/anything on Github, but that should be fine for most users.

devyn commented 8 years ago

@bhallen Ah, I didn't see that before. But it's definitely not ideal; I'd be willing to bet that there are a few where that error-handling code is either not present or doesn't encompass all of the code. For example, although you wouldn't expect an exception outside of the try block in corpustools.gui.migui.MIWorker, it might be possible. So it's probably better to come up with something that handles it automatically.