Your provided Wi-Fi Network my be inadequate in some fashion, and perhaps can be used (for this purpose) in its current state.
Common problems include:
Hidden Network-name
required use of a proxy server to get Internet access
required use of a login page to get Internet access
Use of a login server or certificate to get Internet access
Use of PPPoE in the Mac to get Internet access (typically only applies to DSL)
Use of Fixed IP address rather than good old DHCP
Variance of the time by more than five minutes
Failure of Router to provide workable DNS server addresses, or providing 0.0.0.0 [may produce -2002f]
If you have an Ethernet port, you may in some cases be able to move your Mac close to the Router and connect to the Router using Ethernet.
The higher the number, the more obscure the problem.
If your battery was completely depleted, the Date&Time could have reverted to the default, which will not work. There is a terminal command to reset to current Internet Date&Time -- post back for assistance.
If your Mac starts up to error -1008F
https://support.apple.com/en-us/HT206989