When calling Container.Verify() only the first error is always returns. While this is fine for most scenario's, e.g. when the user forgot to register an interface, it is very useful to see all errors especially when the code is being refactored.
There are possible ways to do this:
- Add an
Container.Verify(bool showAllErrors) overload
- Add a property to the exception thrown by
Container.Verify() that contains the full list of errors, and append text to the exception message stating something like "You are only shown the first error. To see the full list of validation errors, please inspect the ValidationErrors property."
I decided to let Verify() throw a new exception type VerificationException, rather than InvalidOperationException, as this allows all the errors to be wrapped. But throwing a different exception is a breaking change.
When calling
Container.Verify()only the first error is always returns. While this is fine for most scenario's, e.g. when the user forgot to register an interface, it is very useful to see all errors especially when the code is being refactored.There are possible ways to do this:
Container.Verify(bool showAllErrors)overloadContainer.Verify()that contains the full list of errors, and append text to the exception message stating something like "You are only shown the first error. To see the full list of validation errors, please inspect the ValidationErrors property."I decided to let Verify() throw a new exception type
VerificationException, rather thanInvalidOperationException, as this allows all the errors to be wrapped. But throwing a different exception is a breaking change.