[SERVER-18664] Refactor command error handling Created: 26/May/15  Updated: 19/Sep/15  Resolved: 03/Jun/15

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.1.4

Type: Improvement Priority: Major - P3
Reporter: Adam Midvidy Assignee: Adam Midvidy
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-18236 Refactor metadata to use OP_COMMAND m... Closed
Backwards Compatibility: Fully Compatible
Sprint: Platform 4 06/05/15
Participants:

 Description   

Right now we catch AssertionException/UserException multiple times and duplicate the same logic for generating error responses throughout the command execution pipeline.

We should make one method to generate an error reply, and let all exceptions bubble up to a canonical place where it is called.



 Comments   
Comment by Githook User [ 03/Jun/15 ]

Author:

{u'username': u'amidvidy', u'name': u'Adam Midvidy', u'email': u'amidvidy@gmail.com'}

Message: SERVER-18664 make commands always return

{ok: 0.0, errmsg: ..., code: ...}

style responses
Branch: master
https://github.com/mongodb/mongo/commit/f9685f7f8ed8240e763da406e3e97d94e7a919e6

Comment by Githook User [ 03/Jun/15 ]

Author:

{u'username': u'amidvidy', u'name': u'Adam Midvidy', u'email': u'amidvidy@gmail.com'}

Message: SERVER-18664 run dos2unix on invalid_db_name.js
Branch: master
https://github.com/mongodb/mongo/commit/49cbe32ebe03e393b1013575adc321759def25c3

Comment by Adam Midvidy [ 26/May/15 ]

Also, while it would be nice to only have one catch block, we need more as we will have additional context further down the stack that we should expose in error messages.

Comment by Adam Midvidy [ 26/May/15 ]

I need this for the metadata refactor as we can now throw an exception in receivedCommand/receivedRpc if there is invalid metadata. This fix is needed to generate the correct command reply rather than returning a $err error message.

Generated at Thu Feb 08 03:48:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.