Structs
Hal Snyder
hal@REDACTED
Thu Jan 16 17:35:20 CET 2003
Luke Gorrie <luke@REDACTED> writes:
> I still have problems in Erlang in the cases where I don't want to
> crash, i.e. the non-assertion type of error detection. Here's a
> function I wrote recently:
What about cond (or something like it)?
Isn't that coming soon to Erlang?
> connect(Host, User, Password) ->
> case otp_ftp:open(Host) of
> {ok, Pid} ->
> link(Pid),
> case otp_ftp:user(Pid, User, Password) of
> ok ->
> case otp_ftp:pwd(Pid) of
> {ok, Home} ->
> ?event(ftp, "~p: Home is ~p", [self(), Home]),
> case otp_ftp:type(Pid, binary) of
> ok ->
> %% It is at about this level of nesting
> %% that better exception handling in
> %% erlang becomes appetizing..
> {ok, Pid, Home};
> {error, Rsn} ->
> {error, otp_ftp:formaterror(Rsn)}
> end;
> {error, Rsn} ->
> {error, otp_ftp:formaterror(Rsn)}
> end;
> {error, Rsn} ->
> {error, otp_ftp:formaterror(Rsn)}
> end;
> {error, Rsn} ->
> {error, otp_ftp:formaterror(Rsn)}
> end.
More information about the erlang-questions
mailing list