rzezeski/yokozuna — pull request #33 by coderoshi (2013-01-08 02:01:57+00:00)
Title: Searching Nonexistent Index - Better Error Msg

Searching on a non-existent index returns a cryptic error msg like the following. Instead return a 404.

```
curl 'http://localhost:10018/search/blah?q=foofoo'

500 Internal Server Error

Internal Server Error

The server encountered an error while processing this request:

{error,
{throw,
{"Failed to search",
"http://localhost:10016/solr/blah/select?shards=127.0.0.1:10016/solr/blah,127.0.0.1:10026/solr/blah,127.0.0.1:10036/solr/blah,127.0.0.1:10046/solr/blah&q=foofoo&fq=%28_yz_node%3Adev1%40127.0.0.1+AND+_yz_pn%3A1%29+OR+%28_yz_node%3Adev4%40127.0.0.1+AND+_yz_pn%3A4%29+OR+%28_yz_node%3Adev3%40127.0.0.1+AND+_yz_pn%3A7%29+OR+%28_yz_node%3Adev2%40127.0.0.1+AND+_yz_pn%3A10%29+OR+%28_yz_node%3Adev1%40127.0.0.1+AND+_yz_pn%3A13%29+OR+%28_yz_node%3Adev4%40127.0.0.1+AND+_yz_pn%3A16%29+OR+%28_yz_node%3Adev3%40127.0.0.1+AND+_yz_pn%3A19%29+OR+%28_yz_node%3Adev2%40127.0.0.1+AND+_yz_pn%3A22%29+OR+%28_yz_node%3Adev1%40127.0.0.1+AND+_yz_pn%3A25%29+OR+%28_yz_node%3Adev4%40127.0.0.1+AND+_yz_pn%3A28%29+OR+%28_yz_node%3Adev3%40127.0.0.1+AND+_yz_pn%3A31%29+OR+%28_yz_node%3Adev2%40127.0.0.1+AND+_yz_pn%3A34%29+OR+%28_yz_node%3Adev1%40127.0.0.1+AND+_yz_pn%3A37%29+OR+%28_yz_node%3Adev4%40127.0.0.1+AND+_yz_pn%3A40%29+OR+%28_yz_node%3Adev3%40127.0.0.1+AND+_yz_pn%3A43%29+OR+%28_yz_node%3Adev2%40127.0.0.1+AND+_yz_pn%3A46%29+OR+%28_yz_node%3Adev1%40127.0.0.1+AND+_yz_pn%3A49%29+OR+%28_yz_node%3Adev4%40127.0.0.1+AND+_yz_pn%3A52%29+OR+%28_yz_node%3Adev3%40127.0.0.1+AND+_yz_pn%3A55%29+OR+%28_yz_node%3Adev2%40127.0.0.1+AND+_yz_pn%3A58%29+OR+%28_yz_node%3Adev1%40127.0.0.1+AND+_yz_pn%3A61%29+OR+%28_yz_node%3Adev2%40127.0.0.1+AND+_yz_pn%3A62+AND+%28_yz_fpn%3A62%29%29",
{ok,"404",
[{"Content-Type","text/html;charset=ISO-8859-1"},
{"Cache-Control","must-revalidate,no-cache,no-store"},
{"Content-Length","1381"}],
<<"\n

\n\n

Error 404 Not Found

\n

\n

HTTP ERROR 404

\n

Problem accessing /solr/blah/select. Reason:\n

Not Found

Powered by Jetty://
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

\n\n">>}},
[{yz_solr,search,3,[{file,"src/yz_solr.erl"},{line,220}]},
{yz_wm_search,search,2,[{file,"src/yz_wm_search.erl"},{line,68}]},
{webmachine_resource,resource_call,3,
[{file,"src/webmachine_resource.erl"},{line,171}]},
{webmachine_resource,do,3,
[{file,"src/webmachine_resource.erl"},{line,130}]},
{webmachine_decision_core,resource_call,1,
[{file,"src/webmachine_decision_core.erl"},{line,48}]},
{webmachine_decision_core,decision,1,
[{file,"src/webmachine_decision_core.erl"},{line,555}]},
{webmachine_decision_core,handle_request,2,
[{file,"src/webmachine_decision_core.erl"},{line,33}]},
{webmachine_mochiweb,loop,1,
[{file,"src/webmachine_mochiweb.erl"},{line,97}]}]}}

mochiweb+webmachine web server

```