[erlang-questions] Re: Dialyzer and throw/catch

Jachym Holecek freza@REDACTED
Sat Dec 4 22:41:10 CET 2010


# Gordon Guthrie 2010-12-04:
> On further investigation is seems the problem might be with the function
> that is being called. The dialyzer error for it is:
> 
> muin_util.erl:227: The call
> error_logger:error_msg({'error',_,[{atom(),atom(),[any()] | byte()}]} |
> {'throw',_,[{atom(),atom(),[any()] | byte()}]}) will never return since the
> success typing is (string()) -> 'ok' and the contract is (Format::string())
> -> 'ok'

That's right, error_logger:error_msg/1 expects a string argument, but
you're giving it a 3-tuple -- so dialyzer knows that call is going to
explode and correctly concludes muin_util:attempt/3 can only possibly
return {ok, _}. (About time I tried dialyzer more closely, it seems
pretty smart ;-)

> There is no spec for muin_util:atttempt/3 so I am not sure where this
> 'success typing' is coming from..

"Success typing" is the name of the approach dialyzer is using, others
will know more details about it.

Regards,
	-- Jachym


More information about the erlang-questions mailing list