esl/escalus — pull request #31 by lavrin (2014-07-25 09:44:54+00:00)
Title: Use `error/1,2` instead of `exit/1`

This plays much nicer with `ct_tty_hook.erl` included in new `ejabberd_tests`. Instead of getting just the error reason, we also get the stacktrace showing exact location of the error.

I didn't test in the shell/Common Test results all possible/expected outputs these changes cause, but this is not a change in functionality and only affects the amount of information in error logs. If any readability problems or duplicated logs show up we can fix them on the go.

Basically, the difference boils down to this example:

`exit/1`:

> catch exit(asd).
{'EXIT',asd}

`error/1`:

> catch error(asd).
{'EXIT',{asd,[{erl_eval,do_apply,6,
[{file,"erl_eval.erl"},{line,573}]},
{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,357}]},
{shell,exprs,7,[{file,"shell.erl"},{line,674}]},
{shell,eval_exprs,7,[{file,"shell.erl"},{line,629}]},
{shell,eval_loop,3,[{file,"shell.erl"},{line,614}]}]}}

`error/2`:

> catch error(asd, [123, qwe, zxc]).
{'EXIT',{asd,[{erl_eval,do_apply,
[123,qwe,zxc],
[{file,"erl_eval.erl"},{line,573}]},
{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,357}]},
{shell,exprs,7,[{file,"shell.erl"},{line,674}]},
{shell,eval_exprs,7,[{file,"shell.erl"},{line,629}]},
{shell,eval_loop,3,[{file,"shell.erl"},{line,614}]}]}}

There are more places in Escalus code base where `exit/1,2` is used, but I believe it's appropriate there as it is deliberately used to kill a process other than the current one.