<div dir="ltr">Hi Ingela, I think that what you suggest is very clear. Thank you.<br><br><div class="gmail_quote">On Wed, Jul 30, 2008 at 2:35 AM, Ingela Anderton Andin <span dir="ltr"><<a href="mailto:ingela@erix.ericsson.se">ingela@erix.ericsson.se</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Edwin,<br>
<br>
well I suppose it is a little too much of a question of how you define type, and maybe your reasoning is more the common way to reason than mine. I think of "type" in a quite abstract way. But I do not want to argue on what is more right or wrong, I think it is fair to choose another wording that will be more clear to<br>
all. I suggest {invalid_option, {non_existing, {document_root,"/tmp/htdocs"}}}. How do you feel about that?<div class="Ih2E3d"><br>
<br>
Regards - Ingela Erlang/OTP, Ericsson<br>
<br>
Edwin Fine wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
Thanks, Ingela, your solution looks good, but I find it still a little bit misleading. You see, what was provided was actually a directory (in string format). The fact that the directory does not exist has nothing to do with its type, really. What it has to do with is validation. Maybe wrong_type would read better as validation_failed? That covers both type checks and existence checks and any other kind of checks of this sort that may come up in future.<br>
<br>
Regards,<br>
Edwin<br>
<br></div><div><div></div><div class="Wj3C7c">
On Tue, Jul 29, 2008 at 5:15 AM, Ingela Anderton Andin <<a href="mailto:ingela@erix.ericsson.se" target="_blank">ingela@erix.ericsson.se</a> <mailto:<a href="mailto:ingela@erix.ericsson.se" target="_blank">ingela@erix.ericsson.se</a>>> wrote:<br>
<br>
Hi Edwin!<br>
<br>
Well yes in this particular case it becomes a bit confusing I<br>
agree. It is a type check that has fail but this is obviously<br>
a special case of failure so I changed it so it will become<br>
*{wrong_type, {non_existing, document_root,"/tmp/htdocs"}}.<br>
The type check acctualy checks if "/tmp/htdocs" is a directory<br>
and not only that it is a string on the correct format. So the<br>
type here is "directory"<br>
and not "string". But yes I can see that people might get<br>
confused. I think this will be the best solution removing the<br>
wrong_type in this case<br>
will make the code cluttered of special cases in more than one<br>
place, now I just handle the special case where it appeares and<br>
the higer level code does not need to care about such details, and<br>
also it is logical type error, the given parameter was not a valid<br>
directory.<br>
<br>
Regards - Ingela Erlang/OTP, Ericsson<br>
<br>
<br>
*Edwin Fine wrote:<br>
<br>
Taking the example out of the document at<br>
<a href="http://www.erlang.org/doc/apps/inets/http_server.html" target="_blank">http://www.erlang.org/doc/apps/inets/http_server.html</a>:<br>
<br>
2> {ok, Pid} = inets:start(httpd, [{port, 0},<br>
2> {server_name,"httpd_test"}, {server_root,"/tmp"},<br>
2> {document_root,"/tmp/htdocs"}, {bind_address,<br>
"localhost"}]).<br>
<br>
=ERROR REPORT==== 30-Jun-2008::17:47:18 ===<br>
Failed initiating web server:<br>
undefined<br>
*{wrong_type,{document_root,"/tmp/htdocs"}}*<br>
<br>
** exception error: no match of right hand side value<br>
{error,{shutdown,{child,undefined,<br>
{httpd_instance_sup,{0,0,0,0,0,0,0,1},59104},<br>
{httpd_instance_sup,start_link,<br>
[[{port,59104},<br>
{bind_address,{0,0,0,0,0,0,0,1}},<br>
{server_name,"httpd_test"},<br>
{server_root,"/tmp"},<br>
{document_root,"/tmp/htdocs"}],<br>
15000,<br>
{<0.50.0>,#Port<0.126>},<br>
[]]},<br>
permanent,infinity,supervisor,<br>
[httpd_instance_sup]}}}<br>
<br>
The actual problem was that the "/tmp/htdocs" directory did<br>
not exist. I find having an error message of undefined<br>
*{wrong_type,{document_root,"/tmp/htdocs"}} *to be very<br>
misleading. I read it as "the value corresponding to<br>
document_root [i.e. "/tmp/htdocs", of type string] is of the<br>
wrong type". If not a string, what should it be, I wondered?<br>
<br>
When I created the directory and tried again, the message went<br>
away. I would have expected to see something like<br>
{does_not_exist,{document_root,"/tmp/htdocs"}}.<br>
<br>
3> {ok, Pid} = inets:start(httpd, [{port, 0}, 3> {server_name,"httpd_test"}, {server_root,"/tmp"},<br>
3> {document_root,"/tmp/htdocs"}, {bind_address,<br>
"localhost"}]).<br>
{ok,<0.58.0>}<br>
4><br>
<br>
Regards,<br>
Edwin Fine<br>
-- The great enemy of the truth is very often not the lie --<br>
deliberate, contrived and dishonest, but the myth, persistent,<br>
persuasive, and unrealistic. Belief in myths allows the<br>
comfort of opinion without the discomfort of thought.<br>
John F. Kennedy 35th president of US 1961-1963 (1917 - 1963)<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
erlang-bugs mailing list<br></div></div>
<a href="mailto:erlang-bugs@erlang.org" target="_blank">erlang-bugs@erlang.org</a> <mailto:<a href="mailto:erlang-bugs@erlang.org" target="_blank">erlang-bugs@erlang.org</a>><div class="Ih2E3d"><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-bugs" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-bugs</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
-- <br>
For every expert there is an equal and opposite expert - Arthur C. Clarke<br>
</div></blockquote>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>For every expert there is an equal and opposite expert - Arthur C. Clarke<br>
</div>