Fix error reporting for invalid object key.

Use the newfangled `Base::error` method instead of just throwing a SyntaxError.