Is bad for UX replace all content and display the error when an error occurs?

I'm creating a web form and I'd like to know if is bad for UX if, when a submit error occurs, I replace all content (the form inputs) by the error message. The error isn't an error which could be solved by the user (replacing the input for instance) but it's a server error that must be fixed by developers.

For instance, we have the form this way:

enter image description here

and when a login error occurs in the server, all the form is replaced by

enter image description here