manopapad/proper — pull request #36 by samuelrivas (2012-04-22 18:22:26+00:00)
Title: don't clean the stacktrace if the error is a bad use of a proper function

I had a bad time debugging a stupid error in a FSM property. Next simplified (and untested) snippet shows that I mistakenly called the non-existing function proper_fsm:run_commands/1

```erlang
prop_bad_fsm() ->
?FORALL(
Cmds, proper_fsm:commands(?MODULE),
{H, S, R} = proper_fsm:run_commands(Cmds),
?WHENFAIL(report_error(H, S, R), R =:= ok)).
```

This will fail with undef and an empty stracktrace, which is very confusing until you realise what's going on:
```
!
Failed: After 1 test(s).
An exception was raised: error:undef.
Stacktrace: [].
[]
```

With this patch the trace would be something like
```
!
Failed: After 1 test(s).
An exception was raised: error:undef.
Stacktrace: [{proper_fsm,run_commands,
[[{set,{var,1},{foo,bar,[]}}]],
[]},
{test_proper,'-prop_bad_call_fsm/0-fun-2-',3,
[{file,"test_proper.erl"},{line,100}]},
{proper,apply_args,3,[{file,"src/proper.erl"},{line,1327}]},
{proper,child,3,[{file,"src/proper.erl"},{line,1366}]}].
```

Which I think is more informative despite of the extra glibberish.

In any other case, the stacktrace will be as clean as before :)