 = func(*args, **kwargs)
        if isinstance(return_value, int):
            return return_value
    except Exception as e:
        return handle_exception(e)


def try_func(func, *args, **kwargs):
    try:
        value = func(*args, **kwargs)
        return value
    except Exception as e:
        return handle_exception(e)


def handle_exception(error):
    """This will provide a dialog for the user with the error found."""
    traceback = format_exc()

    # Try using a Qt message box, if that fails
    try:
        display_qt_error_box(error, traceback)
    except Exception:
        # If that fails try to write a temp html file
        try:
            display_browser_error_box(error, traceback)
        except Exception:
            print(traceback)
