dolittle-obsolete / DotNET.Fundamentals

Reusable, fundamental abstractions and building blocks
http://www.dolittle.io
MIT License
4 stars 8 forks source link

Wrong Exception thrown when unable to create a type in the Json Serializer #227

Closed smithmx closed 5 years ago

smithmx commented 5 years ago

https://github.com/dolittle-fundamentals/DotNET.Fundamentals/blob/b9f0aa2a022840219e9878704f014f5134a5bacf/Source/Serialization.Json/Serializer.cs#L161

When the type doesn't have a default ctor and we can't match ctor parameters, then we cannot create an instance of the type. That is correct, but we are throwing a NotImplementedException which is not correct.

We should throw a custom type named something like UnableToCreateInstanceOfType and include the name of the type so that the user can see exactly what the issue is.