improving error handling

Neven Has haski at sezampro.yu
Fri Jan 19 04:09:13 PST 2001


On Thu, Jan 18, 2001 at 10:11:51PM +0000, Bryan Dumm wrote:
> Hmmm, I really like the way you have implemented the send_error information.
> But. Thinking about it, and say all the other print messages that are in the 
> subroutines now, how about instead of send_error() we have 
> 
> send_message()
> 
> with some sort of different ways to make up messages? Like error ones, 
> response ones, general info ones, etc.? 
> 
> That way we really define these types of messages in XML and not through
> different subroutines?

Yes, in one of the comments (line 277 :) I suggested exactly that.
We can have a "type" attribute (like jabber does) which can be "normal" (or
"print"), "error", maybe "input" (which will require some input from the user)
etc.

I agree we should have a single subroutine (send_message() sounds great) which
will do that, but for just printing, for example, instead of having:

	$msg = { type => "print", 
		 text => "Dumping text to $file in $dir ..." 
	}
	send_message($msg);

in every place where we have print() now, which will enlarge our code a lot, 
we could have msg_print("Dumping ...") subroutine which will just construct 
a message and then call send_message() ?
But that's only for those simple messages (like print, but not error).

Wow, we are already in phase four ? Time flies ... ;)

Neven







More information about the alfs-discuss mailing list