CreateFrom() static public method

Creates a CKExceptionData from any Exception.
static public CreateFrom ( Exception ex ) : CKExceptionData
ex System.Exception Exception for which data must be created. Can be null: null is returned.
return CKExceptionData
Beispiel #1
0
 /// <summary>
 /// If <see cref="ExceptionData"/> is null, this method creates the <see cref="CKExceptionData"/>
 /// with the details from this exception.
 /// </summary>
 /// <returns>The <see cref="CKExceptionData"/> that describes this exception.</returns>
 public CKExceptionData EnsureExceptionData()
 {
     if (_exceptionData == null)
     {
         var inner = CKExceptionData.CreateFrom(InnerException);
         _exceptionData = new CKExceptionData(Message, "CKException", GetType().AssemblyQualifiedName, StackTrace, inner, null, null, null, null);
     }
     return(_exceptionData);
 }
Beispiel #2
0
 /// <summary>
 /// Gets or creates the <see cref="CKExceptionData"/> that captures exception information.
 /// If <see cref="P:Exception"/> is null, this returns null.
 /// </summary>
 /// <returns>A data representation of the exception or null.</returns>
 public CKExceptionData EnsureExceptionData()
 {
     return(_exceptionData ?? (_exceptionData = CKExceptionData.CreateFrom(_exception)));
 }