[erlang-bugs] Incorrect or misleading inets/http_server error message

Edwin Fine <>
Mon Jun 30 23:56:58 CEST 2008


Taking the example out of the document at
http://www.erlang.org/doc/apps/inets/http_server.html:

2> {ok, Pid} = inets:start(httpd, [{port, 0},
2>       {server_name,"httpd_test"}, {server_root,"/tmp"},
2>       {document_root,"/tmp/htdocs"}, {bind_address, "localhost"}]).

=ERROR REPORT==== 30-Jun-2008::17:47:18 ===
Failed initiating web server:
undefined
*{wrong_type,{document_root,"/tmp/htdocs"}}*

** exception error: no match of right hand side value
{error,{shutdown,{child,undefined,

{httpd_instance_sup,{0,0,0,0,0,0,0,1},59104},

{httpd_instance_sup,start_link,

[[{port,59104},

{bind_address,{0,0,0,0,0,0,0,1}},

{server_name,"httpd_test"},

{server_root,"/tmp"},

{document_root,"/tmp/htdocs"}],

15000,

{<0.50.0>,#Port<0.126>},

[]]},

permanent,infinity,supervisor,

[httpd_instance_sup]}}}

The actual problem was that the "/tmp/htdocs" directory did not exist. I
find having an error message of undefined
*{wrong_type,{document_root,"/tmp/htdocs"}}
*to be very misleading. I read it as "the value corresponding to
document_root [i.e. "/tmp/htdocs", of type string] is of the wrong type". If
not a string, what should it be, I wondered?

When I created the directory and tried again, the message went away. I would
have expected to see something like
{does_not_exist,{document_root,"/tmp/htdocs"}}.

3> {ok, Pid} = inets:start(httpd, [{port, 0},
3>       {server_name,"httpd_test"}, {server_root,"/tmp"},
3>       {document_root,"/tmp/htdocs"}, {bind_address, "localhost"}]).
{ok,<0.58.0>}
4>

Regards,
Edwin Fine
-- 
The great enemy of the truth is very often not the lie -- deliberate,
contrived and dishonest, but the myth, persistent, persuasive, and
unrealistic. Belief in myths allows the comfort of opinion without the
discomfort of thought.
John F. Kennedy 35th president of US 1961-1963 (1917 - 1963)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080630/42628654/attachment.html>


More information about the erlang-bugs mailing list