[SERVER-47424] Fix inconsistencies in error handling with throwing vs returning Status Created: 08/Apr/20  Updated: 06/Dec/22  Resolved: 17/Aug/20

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

Type: Improvement Priority: Major - P3
Reporter: Henrik Edin Assignee: Backlog - Storage Execution Team
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Participants:

 Description   

This came up in CR: https://mongodbcr.appspot.com/591890009

We have some functions reporting errors by throwing where we at a higher level just use Status so we have to catch(...) and return exceptionToStatus()

It would be nice to clean up and rely more on exceptions.

Examples:
https://github.com/mongodb/mongo/blob/2f9f301e0247b059ba652c2488a450f1fbd1d77b/src/mongo/db/index/index_access_method.cpp#L547

https://github.com/mongodb/mongo/blob/2f9f301e0247b059ba652c2488a450f1fbd1d77b/src/mongo/db/catalog/validate_adaptor.cpp#L142

 



 Comments   
Comment by Maria van Keulen [ 09/Apr/20 ]

The createCollection free function has this problem also.

Generated at Thu Feb 08 05:14:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.