Catching FAILURE IN SERVER errors with try

Hello

I’m trying to catch FAILURE IN SERVER - it seems try doesn’t catch them. I reckon finding nodes (/n_set Node 1000 not found) is not part of its remit?

Any help welcome. I can work around registering all nodes and checking they are live, but my question is still there, and more importantly, how could I find the answer myself.

thanks all!

FAILURE IN SERVER is basically just an error message printed by the server. Synchronous commands such as /n_set don’t send any reply back to the client, so there is no chance to catch that error. You need to keep track of your nodes client-side.

1 Like

try can only catch Error objects (well, Exception too) that are .throw-n. This happens only within the language.

aSynth.set prepares and sends a message to the server, and then returns immediately. This is all successful in your case (if it were not successful, the server wouldn’t be trying to execute the command), hence nothing on the language side to catch.

Some server commands (particularly the asynchronous ones, like buffer commands) send a /fail message back to the client. You can receive these in an OSCFunc / OSCdef. As noted though, n_set isn’t one of those. (Even if it were, then you’d have to register to receive the failure message, and assume success after some timeout, which is rather a lot of overhead for a command that is often issued rapidly… and at this point, the language method already exited, so there’s no way to trace back to the caller.)

hjh

1 Like

thanks both this is very usefull. I’ll watch my nodes instead in this case.