Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add traceback for exception in sync log #475

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions everpad/provider/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import argparse
import sys
import logging
import traceback


class ProviderApp(AppClass):
Expand Down Expand Up @@ -83,6 +84,12 @@ def log(self, data):
if self.verbose:
print data

def log_exception(self, e):
self.logger.exception(e)
if self.verbose:
traceback.print_exc()


@Slot()
def terminate(self):
self.sync_thread.quit()
Expand Down
2 changes: 1 addition & 1 deletion everpad/provider/sync/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def perform(self):
except Exception, e: # maybe log this
self.session.rollback()
self._init_db()
self.app.log(e)
self.app.log_exception(e)
finally:
self.sync_state_changed.emit(const.SYNC_STATE_FINISH)
self.status = const.STATUS_NONE
Expand Down
3 changes: 3 additions & 0 deletions everpad/provider/sync/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def _get_full_note(self, note_ttype):

def _create_note(self, note_ttype):
"""Create new note"""

self.app.log("creating %s" % (note_ttype.title))
note_ttype = self._get_full_note(note_ttype)

note = models.Note(guid=note_ttype.guid)
Expand All @@ -238,6 +240,7 @@ def _update_note(self, note_ttype):

def _create_conflict(self, note, note_ttype):
"""Create conflict note"""
self.app.log("create conflict %s" % (note_ttype.title))
conflict_note = models.Note()
conflict_note.from_api(note_ttype, self.session)
conflict_note.guid = ''
Expand Down