-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use error/1,2
instead of exit/1
#31
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Great code, man! Essentially, your pull request comment could be 'codified' into a test or two. You reply:
|
This is internal API and the build system doesn't support convenient testing of this kind of stuff right now.
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. 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}]}]}}
Yeah, whatever ;p |
pzel
pushed a commit
that referenced
this pull request
Aug 8, 2014
Use `error/1,2` instead of `exit/1`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This plays much nicer with
ct_tty_hook.erl
included in newejabberd_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
:error/1
:error/2
: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.