better error for unknown custom EJSON types

Fixes #2017