a serializer can be chosen at runtime, exceptions code is simplified