public RollbarTrace(RollbarFrame[] frames, RollbarException exception) { if (frames == null) { throw new ArgumentNullException("frames"); } if (exception == null) { throw new ArgumentNullException("exception"); } Frames = frames; Exception = exception; }
public RollbarTrace(Exception exception) { if (exception == null) { throw new ArgumentNullException("exception"); } var frames = new StackTrace(exception, true).GetFrames() ?? new StackFrame[0]; Frames = frames.Select(frame => new RollbarFrame(frame)).ToArray(); Exception = new RollbarException(exception); }
public void Exception_cant_be_null() { Assert.Throws<ArgumentNullException>(() => { var rollbarException = new RollbarException((Exception) null); }); }
public void Exceptoin_serializes_message_correctly() { var rollbarException = new RollbarException("Test") {Message = "Oops!"}; Assert.Contains("\"message\":\"Oops!\"", JsonConvert.SerializeObject(rollbarException)); Assert.Contains("\"class\":\"Test\"", JsonConvert.SerializeObject(rollbarException)); }
public void Exceptoin_serializes_description_correctly() { var rollbarException = new RollbarException("Test") { Description = "Oops!" }; Assert.Contains("\"description\":\"Oops!\"", JsonConvert.SerializeObject(rollbarException)); Assert.Contains("\"class\":\"Test\"", JsonConvert.SerializeObject(rollbarException)); }
public void Exception_from_class_name_can_have_description() { var rollbarException = new RollbarException("NotFiniteNumberException") { Description = "Hello World!", }; Assert.Equal("Hello World!", rollbarException.Description); }
public void Exception_serializes_correctly() { var rollbarException = new RollbarException("Test"); Assert.Equal("{\"class\":\"Test\"}", JsonConvert.SerializeObject(rollbarException)); }
public void Exception_from_class_name_can_have_mesasge() { var rollbarException = new RollbarException("NotFiniteNumberException") { Message = "Hello World!", }; Assert.Equal("Hello World!", rollbarException.Message); }
public void Exception_from_class_name_has_class() { var rollbarException = new RollbarException("NotFiniteNumberException"); Assert.Equal("NotFiniteNumberException", rollbarException.Class); }
public void Exception_from_exception_can_have_description() { var rollbarException = new RollbarException(GetException()) { Description = "Hello World!", }; Assert.Equal("Hello World!", rollbarException.Description); }
public void Exception_from_exception_can_have_message() { var rollbarException = new RollbarException(GetException()) { Message = "Hello World!", }; Assert.Equal("Hello World!", rollbarException.Message); }
public void Exception_from_exception_has_class() { var rollbarException = new RollbarException(GetException()); Assert.Equal("System.NotFiniteNumberException", rollbarException.Class); }