Design Q, Knowing what is the best way to handle failure when not ina class scope

M

ManicQin

Hi,
I hope that the subject is not too obfuscated.
Small back ground: In my system I manage many devices each device is
responsible for his own
communication queue.
A thread iterates over all the devices and tries to send one msg from
each device.
Sometimes msgs cannot be sent for obvious reasons (comm lost and etc)
and you need to handle the failure in a right fashion. (stop
processes, Alert problems and etc)

Right now my predecessor thought that it is good and nice design to
add a huge switch case that
if device is x and the operation is y (when Y is a global flag) do z
all this in the Comm::send function...
And I cant change this code because... maybe it's buggy maybe it's
error prone but it works...

So I just wondered (for shi*s and giggles), what other solutions to
this atrocity can you offer
I my self thought of just attaching a callbacks for success\ failure
for each msg...
any other suggestions?

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top