Skip to content
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

show messages only for build exceptions #1529

Merged
merged 1 commit into from
Dec 7, 2018
Merged

show messages only for build exceptions #1529

merged 1 commit into from
Dec 7, 2018

Conversation

adamralph
Copy link
Contributor

@adamralph adamralph commented Dec 7, 2018

Since each target is a one-liner which calls SimpleExec, the stack traces are useless. This changes this:

image

to this:

image

thomaslevesque
thomaslevesque previously approved these changes Dec 7, 2018
Copy link
Member

@thomaslevesque thomaslevesque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @adamralph! Since I merged your other PR, could you please rebase this one?

@blairconrad
Copy link
Member

I very much like the effect, @adamralph. I'm glad you brought the PR though, since I find the new syntax to be a little opaque. But then again, where was I to comment when you were developing it?

@adamralph
Copy link
Contributor Author

Rebased.

It's only a beta feature so I'm still open to suggestions. 😃

BTW - there is another overload which takes a IEnumerable<Type> for specifying an arbitrary number of exception types:

RunTargetsAndExit(args, exceptionMessageOnly: new[] { typeof(CommandException) });

It has the advantage of being able to write exceptionMessageOnly: which, come to think of it, could be reduced to messageOnly:. But as you can see it's quite verbose because of typeof and again, symbol-heavy because of the lack of a nice array initializer in C#. The <T>, <T1, T2>, <T1, T2, T3>, and <T1, T2, T3, T4> methods are just syntactic sugar over this method.

Copy link
Member

@blairconrad blairconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @adamralph!

@blairconrad blairconrad merged commit 811326d into FakeItEasy:develop Dec 7, 2018
@blairconrad
Copy link
Member

Thanks, @adamralph. I suppose if there was a one-type overload that took an exceptionMessageOnly, that would help a little. At least when there's only one type.
I'm trying to think of something else that could convey what's going on without being too wordy, but am so far coming up short. I'll be in touch if that changes!

@thomaslevesque
Copy link
Member

Maybe a predicate parameter would make things clearer

@adamralph adamralph deleted the build-exceptions branch December 7, 2018 23:25
@adamralph
Copy link
Contributor Author

@thomaslevesque I assume you mean like this?

RunTargetsAndExit(args, messageOnly: ex => ex is CommandException);

I really like that! I'll sleep on it, but I think that may be a much better way to do it.

@adamralph
Copy link
Contributor Author

WIP PR: adamralph/bullseye#182

@thomaslevesque
Copy link
Member

@thomaslevesque I assume you mean like this?

Yes!

@blairconrad blairconrad added this to the vNext milestone Dec 10, 2018
@thomaslevesque
Copy link
Member

This change has been released in FakeItEasy 5.0.0.
Thanks @adamralph!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants