-
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
Fall back to other formatters when IArgumentValueFormatter.GetArgumentValueAsString throws an exception or returns null #1690
Comments
Perhaps we should just replace the |
Which is the default behavior if there's no custom formatter, no? |
No. If the value isn't null and there's no custom formatter for the value's type, we will
|
So, can't we just do as if there were no custom formatter? |
We can. I'm in. |
Marking as breaking, as it's a change in behaviour, but I do not think there's any downside. |
Late-breaking change! Using best-available fallback formatter whenenver the preferred formatter throws an exception or returns null. |
This change has been released as part of FakeItEasy 6.0.0-beta.1. |
From a conversation in #1683. At that point I suggested a throwing a
UserCallbackException
, but the documentation for that class says it's "An exception thrown when a user-provided callback throws an exception", so if we want to throw, we should either consider a different exception or update the docs for that class.However, Maybe throwing isn't the best course of action. We're already in an error condition, so derailing that just to tell the user about a different error could confuse things. Perhaps we should just construct a non-null message in its place. Clients who turn nullability warnings on in their test projects will be alerted that
null
isn't the best return value anyhow.The text was updated successfully, but these errors were encountered: