Style advice - errors; compound results

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Style advice - errors; compound results

Stephen Davies-3
Hi,

I'm looking for advice on two matters of style:

1) Errors

I'm going something that uses TCP.  What's the usual style for
handling errors?  (I mean unexpected things - like, data doesn't
arrive from then network peer as expected).  Do I raise an error using
self error:, or do I return some sort of failure code?

If I raise an error, is there a way for the caller to trap that?
This is a server, and we don't want errors popping up all of a sudden
in production.

2) Compound results

My code sends commands to the peer system, and gets back results.  The
result depends on the command, but is at least a success or failure, a
result code, and sometimes more stuff.  On top of that I also might
have the "network" success/failure.

What's the usual way to wrap all this into a result from my class?  I
am leaning to wrapping up this result info into a new object and
passing that object back.  Alternatives are to return the "main"
result, and store the other information to be fetched if needed.  Or,
just return an array or dictionary or something.

So what's the usual style - are there some classes I can look at for
inspiration?

Thanks,
Steve
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners