Avoid invariant when trying to get optional ErrorExtraInfo

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The only way to get errors' extra info is by calling errStatus.extraInfo<TypeOfExtraInfo>() but - if no extraInfo is present - this invariant is hit.
       
      The usual pattern to get extra info is:

      if(errStatus.code == XYZ-Error-Code-I-Definitely-Know-Has-Extra-Info){
         auto extraInfo = errStatus.extraInfo<XYZExtraInfo>();
         ......
      }
      

      However, after the introduction of optional extra info, there is no way to get it just if present.
       
      Currently, the only way of dealing with that is to be 100% sure that the exception carries it or not. That - in other words - means knowing all the possible points where the exception can come from.

              Assignee:
              Pierlauro Sciarelli
              Reporter:
              Pierlauro Sciarelli
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: