Throw exception on invalid method name.