Show More
@@ -436,8 +436,15 b' class Session(Configurable):' | |||||
436 | msg = dict(a=[1,'hi']) |
|
436 | msg = dict(a=[1,'hi']) | |
437 | try: |
|
437 | try: | |
438 | packed = pack(msg) |
|
438 | packed = pack(msg) | |
439 | except Exception: |
|
439 | except Exception as e: | |
440 |
|
|
440 | msg = "packer '{packer}' could not serialize a simple message: {e}{jsonmsg}" | |
|
441 | if self.packer == 'json': | |||
|
442 | jsonmsg = "\nzmq.utils.jsonapi.jsonmod = %s" % jsonapi.jsonmod | |||
|
443 | else: | |||
|
444 | jsonmsg = "" | |||
|
445 | raise ValueError( | |||
|
446 | msg.format(packer=self.packer, e=e, jsonmsg=jsonmsg) | |||
|
447 | ) | |||
441 |
|
448 | |||
442 | # ensure packed message is bytes |
|
449 | # ensure packed message is bytes | |
443 | if not isinstance(packed, bytes): |
|
450 | if not isinstance(packed, bytes): | |
@@ -446,8 +453,15 b' class Session(Configurable):' | |||||
446 | # check that unpack is pack's inverse |
|
453 | # check that unpack is pack's inverse | |
447 | try: |
|
454 | try: | |
448 | unpacked = unpack(packed) |
|
455 | unpacked = unpack(packed) | |
449 | except Exception: |
|
456 | except Exception as e: | |
450 | raise ValueError("unpacker could not handle the packer's output") |
|
457 | msg = "unpacker '{unpacker}' could not handle output from packer '{packer}': {e}{jsonmsg}" | |
|
458 | if self.packer == 'json': | |||
|
459 | jsonmsg = "\nzmq.utils.jsonapi.jsonmod = %s" % jsonapi.jsonmod | |||
|
460 | else: | |||
|
461 | jsonmsg = "" | |||
|
462 | raise ValueError( | |||
|
463 | msg.format(packer=self.packer, unpacker=self.unpacker, e=e, jsonmsg=jsonmsg) | |||
|
464 | ) | |||
451 |
|
465 | |||
452 | # check datetime support |
|
466 | # check datetime support | |
453 | msg = dict(t=datetime.now()) |
|
467 | msg = dict(t=datetime.now()) |
General Comments 0
You need to be logged in to leave comments.
Login now