Beispiel #1
0
def bugsnag_global_callback(notification):
    notification.add_tab('system', {
        'platform': platform.platform(),
        'python': platform.python_version()
    })
    cause = notification.exception.__cause__
    if cause:
        notification.add_tab('original exception', error_to_dict(cause))
Beispiel #2
0
def bugsnag_global_callback(notification):
    notification.add_tab("system", {
        "platform": platform.platform(),
        "python": platform.python_version()
    })
    cause = notification.exception.__cause__
    if cause:
        notification.add_tab("original exception", error_to_dict(cause))
Beispiel #3
0
    def maestral_errors(self):
        """
        Returns a list of Maestral's errors as dicts. This does not include lost internet
        connections or file sync errors which only emit warnings and are tracked and
        cleared separately. Errors listed here must be acted upon for Maestral to
        continue syncing.
        """

        maestral_errors = [
            r.exc_info[1] for r in self._log_handler_error_cache.cached_records
        ]
        maestral_errors_dicts = [error_to_dict(e) for e in maestral_errors]
        return maestral_errors_dicts
Beispiel #4
0
def test_error_to_dict():

    exc1 = RequestException("test error")
    exc2 = SyncError("test", "test")

    serialized_excs = [error_to_dict(exc) for exc in (exc1, exc2)]

    default_keys = ("type", "inherits", "traceback", "title", "message")

    builtin_types = dir(builtins) + [type(None).__name__]

    for serialized_exc in serialized_excs:
        assert all(isinstance(key, str) for key in serialized_exc.keys())
        assert all(
            type(val).__name__ in builtin_types for val in serialized_exc.values()
        )
        assert all(key in serialized_exc for key in default_keys)
def test_error_to_dict():
    from requests.exceptions import RequestException
    from maestral.errors import SyncError

    exc1 = RequestException('test error')
    exc2 = SyncError('test', 'test')

    serialized_excs = [error_to_dict(exc) for exc in (exc1, exc2)]

    default_keys = ('type', 'inherits', 'traceback', 'title', 'message')

    for serialized_exc in serialized_excs:
        assert all(isinstance(key, str) for key in serialized_exc.keys())
        assert all(
            type(val).__name__ in dir(builtins)
            for val in serialized_exc.values())
        assert all(key in serialized_exc for key in default_keys)
Beispiel #6
0
 def sync_errors(self):
     """Returns list containing the current sync errors as dicts."""
     sync_errors = list(self.sync.sync_errors.queue)
     sync_errors_dicts = [error_to_dict(e) for e in sync_errors]
     return sync_errors_dicts