Throw NPE with message when serializer is null.

Spelling a serializer keyword wrong results in an NPE, but one that's annoying to track down. This is a little more up-front about the error.

I'm not sure if there's a more idiomatic way of doing this null-check. Let me know if you want this done in a different way.