- 
    Type:Task 
- 
    Resolution: Done
- 
    Priority:Major - P3 
- 
    Affects Version/s: None
- 
    Component/s: None
- 
        3
- 
        Iteration Utahraptor
- 
        Not Needed
Currently the code associated with an error in mongosh is only available through the logs
https://www.mongodb.com/docs/mongodb-shell/logs/#view-mdb-shell-logs
or
Users can use _error to access the last uncaught exception as a JS value, i.e. _error.code and _error.codeName. 
The legacy shell exposed the error code as part of the response. As this error code can sometimes be useful for debugging the issue I think it would make sense to surface the error code in the response in mongosh as well.
From slack thread:
https://mongodb.slack.com/archives/CUHC9R8J0/p1650400710067119
> david.golub Apr 19th at 16:38
> Is there a way for me to see the error code?