If you are programming a NodeJS server yourself you can decide what error code to return.
But you have to know what error code stands for what. e.x If I mail you about getting error code 406 you would have to know what error it could be.
For a user its easier to just return a message like "Error file uploading has failed please try again later." now the user knows whats wrong and won't bother you anymore.
In your code you can see / return specific messages for if there is a bug. Like "Error something went wrong please notify the system administrator about error code 406"
This way you know whats wrong with your code or where the error happend.
If you are talking about what HTTP error code you need to send you could read a documentation about it here