The only chance to cleanly send errors is at the start of a chunk. So what about
using something like
try:
prepare chunk
except StandardError:
log error
send error
(see 769be3c57564 for an example)
else:
try:
send chunk
except StandardError:
log verbosely, ring alarm bell, whatever
(and try the best on the client side, as before)
Clients not understanding these error chunks are as (un)happy as before, but
newer clients can provide a better error message to the user. |