             mesg : message.codemirror_get_session(path:@path, project_id:@project_id, session_uuid:@session_uuid)
             cb   : (err, resp) =>
                 if err
-                    winston.debug("local_hub --> hub: (connect) error -- #{err}, #{to_json(resp)}, trying to connect to '#{@path}' in #{@project_id}.")
+                    winston.debug("local_hub --> hub: (connect) error -- #{to_json(err)}, #{to_json(resp)}, trying to connect to '#{@path}' in #{@project_id}.")
                     if resp?.path? and resp?.path.indexOf("sage_server.port") != -1
                         err = "The Sage Worksheet server is not running.  The system may be very heavily loaded, you may have messed up a custom install of Sage, or caused problems by customizing your packages.  Make this work in the terminal: <pre> cd ~/.sagemathcloud\necho 'import sage_server, sage_salvus' | sage</pre> then restart the Sage Worksheet server.<br>Or contact <a href='mailto:wstein@uw.edu' target='_blank'>wstein@uw.edu</a> for help."
                     #@local_hub.reconnect()


    _sync: (cb) =>    # cb(err)
        winston.debug("codemirror session -- syncing with local hub")
        @_sync_lock = true
        before = @diffsync_server.live
        @diffsync_server.push_edits (err) =>
            after = @diffsync_server.live

        # Message from some client reporting new edits; we apply them,
        # generate new edits, and send those out so that the client
        # can complete the sync cycle.
        MAX_LOCK_TIME_S = 30

        if @_sync_lock
            if misc.walltime(@_sync_lock) > MAX_LOCK_TIME_S
                 # something is very suspicious -- if we can't sync for this long give up.
                 @destroy()        
            client.push_to_client(message.codemirror_diffsync_retry_later(id:mesg.id))
            return

