|
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.
|