import traceback


def handle_exception(msg, loggable=None):
    """
    Generates a string from message and the current exception.

    :param msg: the message to use
    :type msg: str
    :param loggable: the LoggableObject instance
    :return: the generated string
    :rtype: str
    """
    result = msg + "\n" + traceback.format_exc()
    if loggable is not None:
        loggable.log(result)
    return result