Don't convert object_error's enum to and from int.

This allows the compiler to see the enum and warn about it. While in here,
fix a switch to not use a default and fix style violations.