MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: The `expr ! errors => result' operator



Don Schwarz writes:
> I was just thinking that it would be useful if, in the `expr ! errors =>
> result' operator, the "! errors" part was also optional and would default to
> "! ANY".

It's not optional on purpose, because using ANY is rarely the right thing to
do.  Rather, when converting old !d code, try to figure out precisely which
errors the code is *expecting* to happen and only catch those.  For example, if
a !d verb has the body

	  what = args[1];
	  return what.frobnicator;

and you can tell from context that this is only !d in order to protect against
the case where WHAT doesn't have a FROBNICATOR property (as opposed to cases
like WHAT not being a valid object or the FROBNICATOR property being
unreadable), then rewrite the code like this:

	  what = args[1];
	  return `what.frobnicator ! E_PROPNF';

Then, if one of those *unexpected* errors arises, you'll still hear about it.

	  Pavel


References:

Home | Subject Index | Thread Index