The internet is a network of networks. A gateway is where one network transfers messages to another network. Now and then a gateway forgets what it is doing and has to reboot or something. And when that happens, you get a gateway error.
It can also be a DNS error, but that is usually reported as a DNS error. (It didn't used to be.)
Bottom line: Wait a few minutes and try again.
Here are some things you can do: https://www.howtogeek.com/search/?q=dns