X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=pdm%2Fsrv.py;fp=pdm%2Fsrv.py;h=2ddb9e754f063da74341770ca88e2eda1304b4c7;hb=e7b433ee543b20ca848f23013590e43cf5d8baf0;hp=80f9a260d688a438e0000a248f805c6129e64ef2;hpb=dc1b10b810fa36c126aba450616e9292b85798c5;p=pdm.git diff --git a/pdm/srv.py b/pdm/srv.py index 80f9a26..2ddb9e7 100644 --- a/pdm/srv.py +++ b/pdm/srv.py @@ -10,6 +10,7 @@ which describes the functioning of the REPL and PERF protocols. import os, sys, socket, threading, grp, select import types, pprint, traceback import pickle, struct +from . import perf as mperf __all__ = ["repl", "perf", "listener", "unixlistener", "tcplistener", "listen"] @@ -197,7 +198,7 @@ class perf(object): def bindob(self, id, ob): if not hasattr(ob, "pdm_protocols"): - raise ValueError("Object does not support PDM introspection") + raise mperf.nosuchname("Object does not support PDM introspection") try: proto = ob.pdm_protocols() except Exception as exc: @@ -208,12 +209,12 @@ class perf(object): def bind(self, id, module, obnm): resmod = sys.modules.get(module) if resmod is None: - self.send("-", ImportError("No such module: %s" % module)) + self.send("-", mperf.nosuchname("No such module: %s" % module)) return try: ob = getattr(resmod, obnm) except AttributeError: - self.send("-", AttributeError("No such object: %s" % obnm)) + self.send("-", mperf.nosuchname("No such object: %s" % obnm)) return try: proto = self.bindob(id, ob) @@ -229,7 +230,7 @@ class perf(object): return None ob, protos = ob if proto not in protos: - self.send("-", ValueError("Object does not support that protocol")) + self.send("-", mperf.nosuchproto("Object does not support that protocol: " + proto)) return None return ob @@ -240,7 +241,7 @@ class perf(object): try: ob = src.lookup(obnm) except KeyError as exc: - self.send("-", exc) + self.send("-", mperf.nosuchname(obnm)) return try: proto = self.bindob(tgtid, ob)