-
Notifications
You must be signed in to change notification settings - Fork 179
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
Misleading exception message when failing to create a Dummy #1367
Comments
Should we create a specific exception type, or just adjust the message? |
Perhaps a new exception type. It is annoying that there's no reason for failure. We could add "There's no user-supplied DummyFactory for <type> and it's not a Task. If it's a Task<TResult> or Lazy<TResult>, we couldn't make a Dummy TResult for one of the reasons we're describing now. <type< isn't fakeable. If it's a value type, we couldn't make it using Maybe that needs a little work. (On a slightly more serious note, we could dynamically build the message, selectively omitting some of the "If" clauses.) |
Or we could point at http://fakeiteasy.readthedocs.io/en/stable/dummies/#how-are-the-dummies-made |
Okay. Additional notes on a potentially useful error message:
So that just leaves us with the cases where we fail to create a Fake and then we fail to instantiate a class by providing Dummy arguments to the constructors. |
I'm not sure I understand... From what I can see, it never throws an exception at all if you try to create a dummy
Maybe we could still throw a |
It might do if users have registered a bad DummyFactory.
Possibly. I'm working on something that would ( |
This change has been released as part of FakeItEasy 4.8.0. |
Fails like so:
"Unable to create fake object." is misleading. We were trying to make a Dummy, which need not be a Fake.
The text was updated successfully, but these errors were encountered: