Improve error messages.

Improve function name: ensureDefaultType: It runs the check function, so
checkDefault is much easier to understand.