Recently, Google's John Mueller published what to do if your website goes offline. It was recommended to provide a 503 server status code if the outage is short term. So someone asked if they could provide a 502 server status code instead. John Mueller said you shouldn't.
John was asked on Twitter, "Does the 502 error also work or does it just have to be 503? I want to check this as hosting companies throw different error codes in different cases."
John replied on Twitter: "502 is not the same as a 503 – I would recommend using the correct result code. These durations are not fully documented as they can change and vary." He gave this analogy: "If a bus is temporarily delayed for an unknown time, how long do you wait before looking for something else?"
The HyperText Transfer Protocol (HTTP) 502 error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.
So, stick to the correct server status response code for the correct situation.
Forum discussion on Twitter.