I don't see any reason as to why you should not redirect visitors to a pretty page for any error.
From your perspective, if you don't know the error code, chances are that you can't even do a lot about them, because they probably don't come from your own code.
From a visitor's perspective, they don't care about what went wrong. What are these error codes anyway? They just want to use the website. So whatever went wrong, try to tell them in a simple way and smooth over it. They don't care, so why should you make them?
Ideally handle the error under the hood, but that needs a deeper understanding of your application and stack 😉