Fitbit.NET
Fitbit.NET copied to clipboard
Make FitbitException Serializable
To send it through the wire
_ System.Runtime.Serialization.InvalidDataContractException : Type 'Fitbit.Api.Portable.FitbitTokenException' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types._
Seems reasonable - http://stackoverflow.com/questions/486460/how-to-serialize-an-exception-object-in-c
Just so I can have a better idea for the change, what's the use case for it? Putting it in a queue? Transmitting it over the wire somewhere?
Yes, sending it over the wire. This is specially relevant in the world of micro-services. Where component A may be consuming content from component B, who in turn may receive an exception from Fitbit and needs to convey that back to component A.
@aarondcoleman I appreciate the rational that Mau gave for the issue of serialization of the exception however conceptually if Component B needs to tell Component A that something has happened with the Fitbit communication then I would argue that the consumer system should handle that and not the Fitbit communication library. Thoughts?
Although saying that the general consensus in the interwebs seems to be that exceptions should be serializable so happy to make them so :)