function getResultMessage(result) {
        var message;
        if (result.type === 'log') {
            message = result.toString();
        } else if (result.type === 'expect' && result.passed && !result.passed()) {
            message = result.message;

            if (result.trace.stack) {
                message = result.trace.stack;
            }
        }
        return message;
    }
Extracts the jasmine.log() and/or jasmine.expect() messages from the given result,
including stack traces if available.
@param {Object} result A jasmine result item (from results.getItems()).
@return {string} the error message from that item.