Esempio n. 1
0
def handle_error(msg, exc=None):
    traceback_str = traceback.format_exc()
    log(traceback_str)
    report_issue = False

    # Don't show any dialogs when user cancels
    if traceback_str.find('SystemExit') > 0:
        return

    d = xbmcgui.Dialog()
    if d:
        message = dialog_error(msg)

        # Work out if we should allow an error report
        send_error = can_send_error(traceback_str)

        # Some transient network errors we don't want any reports about
        if ((traceback_str.find('The read operation timed out') > 0)
                or (traceback_str.find('IncompleteRead') > 0)
                or (traceback_str.find('HTTP Error 404: Not Found') > 0)):
            send_error = False

        # Any non-fatal errors, don't allow issue reporting
        if isinstance(exc, NRLException):
            send_error = False

        if send_error:
            latest_version = issue_reporter.get_latest_version()
            version_string = '.'.join([str(i) for i in latest_version])
            if not issue_reporter.is_latest_version(config.VERSION,
                                                    latest_version):
                message.append("Your version of this add-on is outdated. "
                               "Please try upgrading to the latest version: "
                               "v%s" % version_string)
                d.ok(*message)
                return

            # Only report if we haven't done one already
            try:
                message.append("Would you like to automatically "
                               "report this error?")
                report_issue = d.yesno(*message)
            except:
                message.append("If this error continues to occur, "
                               "please report it to our issue tracker.")
                d.ok(*message)
        else:
            # Just show the message
            d.ok(*message)

    if report_issue:
        log("Reporting issue to GitHub...")
        issue_url = issue_reporter.report_issue(traceback_str)
        if issue_url:
            # Split the url here to make sure it fits in our dialog
            split_url = issue_url.replace('/xbmc', ' /xbmc')
            d.ok("%s v%s Error" % (config.NAME, config.VERSION),
                 "Thanks! Your issue has been reported to: %s" % split_url)
            # Touch our file to prevent more than one error report
            save_last_error_report(traceback_str)
Esempio n. 2
0
def handle_error(err=None):
    traceback_str = traceback.format_exc()
    log(traceback_str)
    report_issue = False
    d = xbmcgui.Dialog()
    if d:
        message = dialog_error(err)

        if can_send_error(traceback_str):
            latest_version = issue_reporter.get_latest_version()
            version_string = '.'.join([str(i) for i in latest_version])
            if not issue_reporter.is_latest_version(config.VERSION, latest_version):
                message.append("Your version of this add-on is outdated. Please try upgrading to the latest version: v%s" % version_string)
                d.ok(*message)
                return

            # Only report if we haven't done one already
            try:
                message.append("Would you like to automatically report this error?")
                report_issue = d.yesno(*message)
            except:
                message.append("If this error continues to occur, please report it to our issue tracker.")
                d.ok(*message)
        else:
            # Just show the message
            d.ok(*message)
    if report_issue:
        log("Reporting issue to GitHub...")
        issue_url = issue_reporter.report_issue(traceback_str)
        if issue_url:
            # Split the url here to make sure it fits in our dialog
            split_url = issue_url.replace('/xbmc', ' /xbmc')
            d.ok("%s v%s Error" % (config.NAME, config.VERSION), "Thanks! Your issue has been reported to: %s" % split_url)
            # Touch our file to prevent more than one error report
            save_last_error_report(traceback_str)
Esempio n. 3
0
def handle_error(msg, exc=None):
    traceback_str = traceback.format_exc()
    log(traceback_str)
    report_issue = False

    # Don't show any dialogs when user cancels
    if traceback_str.find('SystemExit') > 0:
        return

    d = xbmcgui.Dialog()
    if d:
        message = dialog_error(msg)

        # Work out if we should allow an error report
        send_error = can_send_error(traceback_str)

        # Some transient network errors we don't want any reports about
        if ((traceback_str.find('The read operation timed out') > 0) or
            (traceback_str.find('IncompleteRead') > 0) or
            (traceback_str.find('HTTP Error 404: Not Found') > 0)):
                send_error = False

        # Any non-fatal errors, don't allow issue reporting
        if isinstance(exc, AFLVideoException):
            send_error = False

        if send_error:
            latest_version = issue_reporter.get_latest_version()
            version_string = '.'.join([str(i) for i in latest_version])
            if not issue_reporter.is_latest_version(config.VERSION,
                                                    latest_version):
                message.append("Your version of this add-on is outdated. "
                               "Please try upgrading to the latest version: "
                               "v%s" % version_string)
                d.ok(*message)
                return

            # Only report if we haven't done one already
            try:
                message.append("Would you like to automatically "
                               "report this error?")
                report_issue = d.yesno(*message)
            except:
                message.append("If this error continues to occur, "
                               "please report it to our issue tracker.")
                d.ok(*message)
        else:
            # Just show the message
            d.ok(*message)

    if report_issue:
        log("Reporting issue to GitHub...")
        issue_url = issue_reporter.report_issue(traceback_str)
        if issue_url:
            # Split the url here to make sure it fits in our dialog
            split_url = issue_url.replace('/xbmc', ' /xbmc')
            d.ok("%s v%s Error" % (config.NAME, config.VERSION),
                 "Thanks! Your issue has been reported to: %s" % split_url)
            # Touch our file to prevent more than one error report
            save_last_error_report(traceback_str)
Esempio n. 4
0
def send_report(title, trace=None, connection_info=None, user_initiated=False):
    try:
        import issue_reporter
        log("Reporting issue to GitHub")

        if not connection_info:
            connection_info = issue_reporter.get_connection_info()

        if user_initiated:
            if not is_valid_country(connection_info):
                return

        # Show dialog spinner, and close afterwards
        xbmc.executebuiltin("ActivateWindow(busydialog)")
        report_url = issue_reporter.report_issue(title, trace, connection_info)

        split_url = report_url.replace('/issue-reports', ' /issue-reports')
        dialog_message(
            ['Thanks! Your issue has been reported to: ', split_url])
        return report_url
    except Exception:
        traceback.print_exc()
        log('Failed to send report')
    finally:
        xbmc.executebuiltin("Dialog.Close(busydialog)")
Esempio n. 5
0
def send_report(title, trace=None, connection_info=None, user_initiated=False):
    try:
        dialog_progress = xbmcgui.DialogProgress()
        dialog_created = False
        import issue_reporter
        log("Reporting issue to GitHub")

        if not connection_info:
            connection_info = issue_reporter.get_connection_info()

        if user_initiated:
            if not is_valid_country(connection_info):
                return
            if not xbmcgui.Dialog().yesno(
                    '{0} v{1}'.format(get_addon_name(), get_addon_version()),
                    'Please confirm you would like to submit an issue report '
                    'and upload your logfile to Github. '):
                log('Cancelled user report')
                return

        # Show dialog spinner, and close afterwards
        dialog_progress.create('Uploading issue to GitHub...')
        dialog_created = True

        if not issue_reporter.is_supported_addon():
            xbmcgui.Dialog().ok(
                '{0} v{1}'.format(get_addon_name(), get_addon_version()),
                'This add-on is no longer supported by Aussie Add-ons.')
            log('Add-on not supported, aborting issue report.')
            return

        report_url = issue_reporter.report_issue(title, trace, connection_info)

        split_url = report_url.replace('/issue-reports', ' /issue-reports')
        dialog_message([
            'Thanks! Your issue has been reported to: ', split_url,
            'Please visit and describe the issue in order for '
            'us to assist.'
        ])
        return report_url
    except Exception:
        traceback.print_exc()
        log('Failed to send report')
    finally:
        if dialog_created:
            dialog_progress.close()
Esempio n. 6
0
def handle_error(err=None):
    traceback_str = traceback.format_exc()
    log(traceback_str)
    report_issue = False
    d = xbmcgui.Dialog()
    if d:
        message = dialog_error(err)

        if can_send_error(traceback_str):
            latest_version = issue_reporter.get_latest_version()
            version_string = '.'.join([str(i) for i in latest_version])
            if not issue_reporter.is_latest_version(config.VERSION,
                                                    latest_version):
                message.append(
                    "Your version of this add-on is outdated. Please try upgrading to the latest version: v%s"
                    % version_string)
                d.ok(*message)
                return

            # Only report if we haven't done one already
            try:
                message.append(
                    "Would you like to automatically report this error?")
                report_issue = d.yesno(*message)
            except:
                message.append(
                    "If this error continues to occur, please report it to our issue tracker."
                )
                d.ok(*message)
        else:
            # Just show the message
            d.ok(*message)
    if report_issue:
        log("Reporting issue to GitHub...")
        issue_url = issue_reporter.report_issue(traceback_str)
        if issue_url:
            # Split the url here to make sure it fits in our dialog
            split_url = issue_url.replace('/xbmc', ' /xbmc')
            d.ok("%s v%s Error" % (config.NAME, config.VERSION),
                 "Thanks! Your issue has been reported to: %s" % split_url)
            # Touch our file to prevent more than one error report
            save_last_error_report(traceback_str)