public void SerializeDeserializeLogMessage_withException() { var ser = new BSONSerializer(new BSONTypeResolver(typeof(Message))); var msg = new Azos.Log.Message { Type = MessageType.DebugGlue, UTCTimeStamp = Ambient.UTCNow, Channel = Atom.Encode("MTV"), From = "Zhaba", Topic = "App", Text = "Hello text", Source = 12345, Parameters = "aaaaa", ArchiveDimensions = "a=1 b=2", Exception = WrappedException.ForException(new Exception("It is an error!!!")) }; var doc = ser.Serialize(msg); Console.WriteLine(doc.ToJson(JsonWritingOptions.PrettyPrint)); var got = ser.Deserialize(doc) as Azos.Log.Message; testMsgEquWoError(msg, got); Aver.IsTrue(got.Exception is WrappedException); Aver.AreEqual(msg.Exception.Message, got.Exception.Message); Aver.AreEqual(((WrappedException)msg.Exception).Wrapped.Message, ((WrappedException)got.Exception).Wrapped.Message); }
public static Message ThisOrNewSafeWrappedException(this Message msg, bool captureStack = true) { if (msg == null || msg.Exception == null || msg.Exception is WrappedException) { return(msg); } var clone = msg.Clone(); clone.Exception = WrappedException.ForException(msg.Exception, captureStack); return(clone); }
public WrappedXunitException(WrappedException ex) : base(ex.ToString(), "(See error message)") { }
/// <summary> /// Constructor /// </summary> /// <param name="message">the exception message</param> /// <param name="e">the inner Exception.</param> public SimulationException(string message, WrappedException e) : base(message, e) { }