def METHOD_NAME(code, msgs, e):
    """ Exit with a code. Message will head exception info.
        Traceback will be added to email log and written to disk.
        Email log is sent.
    """
    header = ''
    if msgs:
        if type(msgs) not in [type([]), type(())]:
            msgs = (msgs, )
        for msg in msgs:
            header = header + str(msg) + '\n'
        header = header + '\n'
    # write to disk (log file) and email
    tb = header + fetchTraceback()
    syncLib.log2disk(-1, tb)
    # force the whole email thing
    syncLib.initEMAIL_LOG()
    syncLib.log2email(-1, tb)
    # write to stderr, send the email, and exit
    stderrmsg = header + "(Check logs/email for potentially more detail)\n" + \
        repr_str(e) + '\n'
    satsync.sendMail(forceEmail=1)
    systemExit(code, stderrmsg)