Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-38368

Allow handling ErrorCategory types for Futures error handling

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.8
    • Affects Version/s: None
    • Component/s: Concurrency
    • Labels:
      None
    • Fully Compatible
    • Service Arch 2019-01-28, Service Arch 2019-02-11

      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 */)
      

            Assignee:
            jonathan.ma@mongodb.com Jonathan Ma
            Reporter:
            matthew.saltz@mongodb.com Matthew Saltz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: