public override void UpdateDocument(MongoCollection <BsonDocument> collection, BsonDocument document) { var errorRepository = new ErrorRepository(collection.Database, null, null, null); BsonValue id = document.GetDocumentId(); if (id == null || !id.IsObjectId) { return; } Error error = errorRepository.GetById(id.ToString()); if (error == null) { return; } if (document.Contains("sig")) { document.Remove("sig"); } var signatureFactory = new ErrorSignatureFactory(); // updates the document to set the IsSignatureTarget ErrorSignature signature = signatureFactory.GetSignature(error); errorRepository.Update(error); }
public StackingInfo(Error error, ErrorSignatureFactory errorSignatureFactory) { if (error == null) { throw new ArgumentNullException("error"); } ErrorInfo innerMostError = error.GetInnermostError(); Method defaultMethod = innerMostError.StackTrace != null?innerMostError.StackTrace.FirstOrDefault() : null; if (defaultMethod == null && error.StackTrace != null) { defaultMethod = error.StackTrace.FirstOrDefault(); } Tuple <ErrorInfo, Method> st = error.GetStackingTarget(); // if we can't find the info, try doing a new signature to mark the target. if (st == null) { ErrorSignature sig = errorSignatureFactory.GetSignature(error); st = error.GetStackingTarget(); } Error = st != null ? st.Item1 ?? error : error.GetInnermostError(); Method = st != null ? st.Item2 : defaultMethod; if (error.Code == "404" && error.RequestInfo != null && !String.IsNullOrEmpty(error.RequestInfo.Path)) { Is404 = true; Path = error.RequestInfo.Path; } }
public static StackingInfo GetStackingInfo(this Error error, ErrorSignatureFactory errorSignatureFactory = null) { if (errorSignatureFactory == null) { errorSignatureFactory = new ErrorSignatureFactory(); } return(error == null ? null : new StackingInfo(error, errorSignatureFactory)); }
public AssignToStackAction(ErrorStackRepository stackRepository, ErrorSignatureFactory signatureFactory) { _stackRepository = stackRepository; _signatureFactory = signatureFactory; }