moving general-purpose functions from httpd_util to stdlib
Luke Gorrie
luke@REDACTED
Mon Apr 14 15:20:39 CEST 2003
Ulf Wiger <etxuwig@REDACTED> writes:
> >an alternative to this problem is described by Richard Carlsson:
> >
> > - A function should *not* return wrapped values like
> > {ok,Value}/{error,Reason} to indicate success or
> > failure. The assumed behaviour should be success,
> > and failures should be signalled by exceptions,
> > as described below.
>
> This is the behaviour I much prefer.
>
> I think one should always try to think about what a user can
> reasonably do if the requested operation doesn't succeed. If
> the normal case is to exit, then I think it's best to have
> the original function exit right away. If the odd caller
> does not want to exit, there's always catch.
I agree, except that I'm not comfortable enough with using 'catch',
since it always catches everything and mucks up your backtraces. I
would like to have more explicit control over what I actually catch.
The proposed 'try-catch' construct could be nice for this.
Cheers,
Luke
More information about the erlang-questions
mailing list