Wondering what is the most appropiate Exception to throw when there is some case where I get an implementation of in interface that I dont expect
Is there such a thing as UnsupportedTypeException in .net that I m not aware of? Cheers
Wondering what is the most appropiate Exception to throw when there is some case where I get an implementation of in interface that I dont expect
Is there such a thing as UnsupportedTypeException in .net that I m not aware of? Cheers
NotSupportedException exists that may be what you want to consider.
What is not supported? When its not supported, why does your funtion takes it as parameter? This is not good design, because the workflow relays on Exceptions and can result in unpredictable behaviour in future. One alternative would be to overload such functions and be more specific with the given types. When you are sure that this type should not yet be used but will be supported in foreseeable time, you could throw a NotSupportedException with an understandable Errormessage.