Created
July 14, 2017 12:48
-
-
Save mikehadlow/06dafe9457a76aa5bc5a75639a376bf5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private XmlElement FaultFromException(Exception exception) | |
=> (exception is TargetInvocationException targetInvocationException) | |
? FaultFromException(targetInvocationException.InnerException) | |
: (exception is SonosException sonosException) | |
? XmlElementFromFault(new SoapFault | |
{ | |
FaultCode = sonosException.FaultCode, | |
FaultString = sonosException.FaultString, | |
Detail = sonosException.Detail | |
}) | |
: XmlElementFromFault(new SoapFault | |
{ | |
FaultCode = SonosException.ServiceUnknownError, | |
FaultString = $"{exception.GetType().Name}: '{exception.Message}'", | |
Detail = exception.ToString() | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment