extend/cowboy — pull request #421 by lafka (2013-02-11 10:38:40+00:00)
Title: Pretty print errors if `eunit_lib` is available

Improve the error messages when eunit_lib is available.
This is mostly to aid in development, if eunit_lib is not included in code_path formating will default to old behaviour.

**Example of current error:**

```
11:05:55.796 [error] ** Cowboy handler pelle_http_container_handler terminating in handle/2
for the reason error:function_clause
** Options were []
** Request was [{socket,#Port<0.5176>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.93.0>},{method,<<"GET">>},{version,{1,1}},{peer,{{127,0,0,1},55680}},{host,<<"localhost">>},{host_info,undefined},{port,8080},{path,<<"/container"
** Stacktrace: [{tavern_marshal,map_mime,[[{<<"application">>,<<"json">>,1.0}]],[{file,"src/tavern_marshal.erl"},{line,22}]},{tavern_marshal,encode,2,[{file,"src/tavern_marshal.erl"},{line,18}]},{pelle_http_container_handler,init,2,[{file,"src/pelle_http_container_handler.erl"},{line,23}]},{cowboy_handler,handler_init,4,[{file,"src/cowboy_handler.erl"},{line,52}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,500}]
```

**This pull request replaces the current stacktrace with `...` and adds a second error message:**
```
11:14:19.937 [error] in function tavern_marshal:map_mime/1 (src/tavern_marshal.erl, line 22)
called as map_mime([{<<"application">>,<<"json">>,1.0}])
in call from tavern_marshal:encode/2 (src/tavern_marshal.erl, line 18)
in call from pelle_http_container_handler:init/2 (src/pelle_http_container_handler.erl, line 23)
in call from cowboy_handler:handler_init/4 (src/cowboy_handler.erl, line 52)
in call from cowboy_protocol:execute/4 (src/cowboy_protocol.erl, line 500)
**error:function_clause
```