check_method function

Check if the method is supported. If not, throws error.