From b9aea3daf145009f0fb6e03103270f3da20b3fb5 Mon Sep 17 00:00:00 2001 From: Pieter Date: Thu, 16 Feb 2017 12:40:21 +0100 Subject: [PATCH] add warnings for remote exceptions --- pyqtgraph/multiprocess/remoteproxy.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyqtgraph/multiprocess/remoteproxy.py b/pyqtgraph/multiprocess/remoteproxy.py index 208e17f4..6d738f0a 100644 --- a/pyqtgraph/multiprocess/remoteproxy.py +++ b/pyqtgraph/multiprocess/remoteproxy.py @@ -1,6 +1,7 @@ import os, time, sys, traceback, weakref import numpy as np import threading +import warnings try: import __builtin__ as builtins import cPickle as pickle @@ -21,6 +22,9 @@ class NoResultError(Exception): because the call has not yet returned.""" pass +class RemoteExceptionWarning(UserWarning): + """Emitted when a request to a remote object results in an Exception """ + pass class RemoteEventHandler(object): """ @@ -502,9 +506,9 @@ class RemoteEventHandler(object): #print ''.join(result) exc, excStr = result if exc is not None: - print("===== Remote process raised exception on request: =====") - print(''.join(excStr)) - print("===== Local Traceback to request follows: =====") + warnings.warn("===== Remote process raised exception on request: =====", RemoteExceptionWarning) + warnings.warn(''.join(excStr), RemoteExceptionWarning) + warnings.warn("===== Local Traceback to request follows: =====", RemoteExceptionWarning) raise exc else: print(''.join(excStr))