Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1198

Show the code for an error with the error response

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.4
    • Affects Version/s: None
    • Component/s: None
    • 3
    • Not Needed
    • Iteration Utahraptor

      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?

            Assignee:
            paula.stachova@mongodb.com Paula Stachova
            Reporter:
            rhys.howell@mongodb.com Rhys Howell
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: