Recovering from, or ignoring errors


#1

First of all, I’m new to this forum and I’m having a great time with uLisp.

A project of my continually polls a server using with_client sometimes however this server is not available and uLisp stops the loop and gives me the error “Error: ‘with-client’ connection failed”.

I’m ooking for a way to ignore this error and continue with the polling loop but do not know how. I’ve looked at the documentation but cannot find anything.

Is this possible?

Thank you.


#2

I agree that this isn’t very helpful. I’ll investigate whether there’s a solution to this.


#3

Okay thank you very much!, in the meantime I forked the code to just ignore the error.


#4

My proposed solution is to change the line in sp_withclient() from:

if (!success) error(PSTR("'with-client' connection failed"));

to:

if (!success) return nil;

You can then test for the return value nil and continue if you want to. Does this meet your requirements? Would a different value be more useful to distinguish this case from server.available() failing?


#5

Yes, that is what I have done. For me this is a good solution. Thank you very much!