Esempio n. 1
0
        public DataModel CreateExceptionNotice(Exception ex, string message = null, string level = "error")
        {
            var body  = BodyModelBuilder.CreateExceptionBody(ex);
            var model = Create(level, body);

            //merge exception data dictionaries to list of keyValues pairs
            var keyValuePairs = body.TraceChain.Where(tm => tm.Exception.Data != null).SelectMany(tm => tm.Exception.Data);

            foreach (var keyValue in keyValuePairs)
            {
                //the keys in keyValuePairs aren't necessarily unique, so don't add but overwrite
                model.Custom[keyValue.Key.ToString()] = keyValue.Value;
            }

            model.Title = message;

            return(model);
        }
Esempio n. 2
0
        public DataModel CreateExceptionNotice(Exception ex, string message = null, string level = "error")
        {
            var body  = BodyModelBuilder.CreateExceptionBody(ex);
            var model = Create(level, body);

            // if the exception has a fingerprint property, copy it to the notice
            if (!string.IsNullOrEmpty(body.Trace.Exception.Fingerprint))
            {
                model.Fingerprint = FingerprintHash(body.Trace.Exception.Fingerprint);
            }

            if (body.Trace.Exception.Data != null)
            {
                model.Custom["exception_data"] = body.Trace.Exception.Data;
            }

            model.Title = message;

            return(model);
        }