[SERVER-38368] Allow handling ErrorCategory types for Futures error handling Created: 03/Dec/18  Updated: 29/Oct/23  Resolved: 25/Jan/19

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

Type: Task Priority: Major - P3
Reporter: Matthew Saltz (Inactive) Assignee: Jonathan Ma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2019-01-28, Service Arch 2019-02-11
Participants:

 Description   

In the same way we allow

myFuture
  .onError<SomeErrorCode>(/ * Handle this type of error */ )
  .onError<SomeOtherCode>(/* Handle other type of error */)
  .onError(/* handle all other errors */)

it would be nice to have a way to do this with ErrorCategory types, like ShutdownError, since frequently these all need to be handled the same way.

E.g.

myFuture
  .onError<SomeErrorCode>(/ * Handle this type of error */ )
  .onError<SomeOtherCode>(/* Handle other type of error */)
  .onErrorCategory<ErrorCategory::ShutdownError>(/* Handle error for which isShutdownError(code) is true */)
  .onError(/* handle all other errors */)



 Comments   
Comment by Githook User [ 25/Jan/19 ]

Author:

{'email': 'jonathan.ma@mongodb.com', 'name': 'Jonathan Ma'}

Message: SERVER-38368 Allow handling ErrorCategory types for Futures error handling
Branch: master
https://github.com/mongodb/mongo/commit/6d1458c964e600a07b183d0d5331eff0bcab9493

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