Example #1
0
 //
 // Add an error if there are attributes that have not been examined,
 // and are therefore unrecognized.
 //
 internal void VerifyNoUnrecognizedAttributes(ExceptionAction action)
 {
     if (_reader.MoveToNextAttribute())
     {
         AddErrorUnrecognizedAttribute(action);
     }
 }
Example #2
0
            public void Add(Type exceptionType, ExceptionAction exceptionAction)
            {
                ExceptionCell[] newExceptionArray;

                if (exceptionArray.Length > 0)
                {
                    foreach (var exception_for in exceptionArray)
                    {
                        if (exceptionType == exception_for.ExceptionType)
                        {
                            throw new ExceptionListException("This type of exception already in the exception list");
                        }
                    }

                    newExceptionArray = new ExceptionCell[exceptionArray.Length + 1];
                    for (int i = 0; i < exceptionArray.Length; i++)
                    {
                        newExceptionArray[i] = exceptionArray[i];
                    }

                    newExceptionArray[exceptionArray.Length] = new ExceptionCell(exceptionType, exceptionAction);

                    exceptionArray = newExceptionArray;
                    return;
                }
                newExceptionArray    = new ExceptionCell[1];
                newExceptionArray[0] = new ExceptionCell(exceptionType, exceptionAction);
                exceptionArray       = newExceptionArray;
            }
Example #3
0
 public ExceptionList(ExceptionAction defaultExceptionAction)
 {
     exceptionArray    = new ExceptionCell[1];
     exceptionArray[0] = new ExceptionCell {
         ExceptionType = typeof(Exception), ExceptionAction = defaultExceptionAction
     };
 }
Example #4
0
        // Verify and Retrieve the Boolean Attribute.  If it is not
        // a valid value then log an error and set the value to a given default.
        internal void VerifyAndGetBooleanAttribute(
            ExceptionAction action, bool defaultValue, out bool newValue)
        {
            if (Reader.Value == "true")
            {
                newValue = true;
            }
            else
            {
                if (Reader.Value == "false")
                {
                    newValue = false;
                }
                else
                {
                    // Unrecognized value
                    newValue = defaultValue;

                    ConfigurationErrorsException ex = new ConfigurationErrorsException(
                        string.Format(SR.Config_invalid_boolean_attribute, Reader.Name),
                        this);

                    SchemaErrors.AddError(ex, action);
                }
            }
        }
Example #5
0
        internal void AddErrorUnrecognizedElement(ExceptionAction action)
        {
            ConfigurationErrorsException ex = new ConfigurationErrorsException(
                SR.GetString(SR.Config_base_unrecognized_element),
                this);

            SchemaErrors.AddError(ex, action);
        }
Example #6
0
        internal void AddErrorRequiredAttribute(string attrib, ExceptionAction action)
        {
            ConfigurationErrorsException ex = new ConfigurationErrorsException(
                SR.GetString(SR.Config_missing_required_attribute, attrib, _reader.Name),
                this);

            SchemaErrors.AddError(ex, action);
        }
Example #7
0
        internal void AddErrorUnrecognizedAttribute(ExceptionAction action)
        {
            ConfigurationErrorsException ex = new ConfigurationErrorsException(
                string.Format(SR.Config_base_unrecognized_attribute, Reader.Name),
                this);

            SchemaErrors.AddError(ex, action);
        }
Example #8
0
        internal void AddErrorReservedAttribute(ExceptionAction action)
        {
            ConfigurationErrorsException ex = new ConfigurationErrorsException(
                SR.GetString(SR.Config_reserved_attribute, _reader.Name),
                this);

            SchemaErrors.AddError(ex, action);
        }
Example #9
0
 internal bool VerifyRequiredAttribute(object o, string attrName, ExceptionAction action)
 {
     if (o == null)
     {
         this.AddErrorRequiredAttribute(attrName, action);
         return(false);
     }
     return(true);
 }
Example #10
0
 internal void StrictSkipToNextElement(ExceptionAction action)
 {
     this._reader.Skip();
     while (!this._reader.EOF && (this._reader.NodeType != XmlNodeType.Element))
     {
         this.VerifyIgnorableNodeType(action);
         this._reader.Read();
     }
 }
Example #11
0
        public bool GenericExceptionCatchPoint(string exception, out ExceptionAction action)
        {
            if (generic_exc_handler != null)
            {
                return(generic_exc_handler(exception, out action));
            }

            action = ExceptionAction.None;
            return(false);
        }
Example #12
0
        internal void VerifyIgnorableNodeType(ExceptionAction action)
        {
            XmlNodeType nodeType = this._reader.NodeType;

            if ((nodeType != XmlNodeType.Comment) && (nodeType != XmlNodeType.EndElement))
            {
                ConfigurationException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_unrecognized_element"), this);
                this.SchemaErrors.AddError(ce, action);
            }
        }
Example #13
0
 internal void StrictReadToNextElement(ExceptionAction action)
 {
     while (this._reader.Read())
     {
         if (this._reader.NodeType == XmlNodeType.Element)
         {
             return;
         }
         this.VerifyIgnorableNodeType(action);
     }
 }
 public BasicExceptionHandler(ExpressionRuleData data)
 {
     _action = data.Action;
     if (data.UseRegex)
     {
         _regexExpression = new Regex(data.Expression);
     }
     else
     {
         _simpleExpression = data.Expression;
     }
 }
Example #15
0
 internal void VerifyAndGetNonEmptyStringAttribute(ExceptionAction action, out string newValue)
 {
     if (!string.IsNullOrEmpty(this._reader.Value))
     {
         newValue = this._reader.Value;
     }
     else
     {
         newValue = null;
         ConfigurationException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Empty_attribute", new object[] { this._reader.Name }), this);
         this.SchemaErrors.AddError(ce, action);
     }
 }
Example #16
0
        //
        // Read to the next start element, and verify that all XML nodes read are permissible.
        //
        internal void StrictReadToNextElement(ExceptionAction action)
        {
            while (_reader.Read())
            {
                // optimize for the common case
                if (_reader.NodeType == XmlNodeType.Element)
                {
                    return;
                }

                VerifyIgnorableNodeType(action);
            }
        }
Example #17
0
        //
        // Add an error if the node type is not permitted by the configuration schema.
        //
        internal void VerifyIgnorableNodeType(ExceptionAction action)
        {
            XmlNodeType nodeType = _reader.NodeType;

            if (nodeType != XmlNodeType.Comment && nodeType != XmlNodeType.EndElement)
            {
                ConfigurationException ex = new ConfigurationErrorsException(
                    SR.GetString(SR.Config_base_unrecognized_element),
                    this);

                SchemaErrors.AddError(ex, action);
            }
        }
Example #18
0
        internal void StrictSkipToOurParentsEndElement(ExceptionAction action)
        {
            int depth = this._reader.Depth;

            while (this._reader.Depth >= depth)
            {
                this._reader.Skip();
            }
            while (!this._reader.EOF && (this._reader.NodeType != XmlNodeType.EndElement))
            {
                this.VerifyIgnorableNodeType(action);
                this._reader.Read();
            }
        }
Example #19
0
        //
        // StrictSkipToOurParentsEndElement
        //
        // Skip until we hit the end element for our parent, and verify
        // that nodes at the parent level are permissible.
        //
        internal void StrictSkipToOurParentsEndElement(ExceptionAction action)
        {
            int currentDepth = _reader.Depth;

            // Skip everything at out current level
            while (_reader.Depth >= currentDepth)
            {
                _reader.Skip();
            }

            while (!_reader.EOF && _reader.NodeType != XmlNodeType.EndElement)
            {
                VerifyIgnorableNodeType(action);
                _reader.Read();
            }
        }
        //
        // Add a configuration Error.
        //
        internal void AddError(ConfigurationException ce, ExceptionAction action) {
            switch (action) {
                case ExceptionAction.Global:
                    ErrorsHelper.AddError(ref _errorsAll, ce);
                    ErrorsHelper.AddError(ref _errorsGlobal, ce);
                    break;

                case ExceptionAction.NonSpecific:
                    ErrorsHelper.AddError(ref _errorsAll, ce);
                    break;

                case ExceptionAction.Local:
                    ErrorsHelper.AddError(ref _errorsLocal, ce);
                    break;
            }
        }
Example #21
0
 internal void VerifyAndGetBooleanAttribute(ExceptionAction action, bool defaultValue, out bool newValue)
 {
     if (this._reader.Value == "true")
     {
         newValue = true;
     }
     else if (this._reader.Value == "false")
     {
         newValue = false;
     }
     else
     {
         newValue = defaultValue;
         ConfigurationErrorsException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_invalid_boolean_attribute", new object[] { this._reader.Name }), this);
         this.SchemaErrors.AddError(ce, action);
     }
 }
Example #22
0
        internal void VerifyAndGetNonEmptyStringAttribute(ExceptionAction action, out string newValue)
        {
            if (!String.IsNullOrEmpty(_reader.Value))
            {
                newValue = _reader.Value;
            }
            else
            {
                newValue = null;

                ConfigurationException ex = new ConfigurationErrorsException(
                    SR.GetString(SR.Empty_attribute, _reader.Name),
                    this);

                SchemaErrors.AddError(ex, action);
            }
        }
Example #23
0
        internal void AddError(ConfigurationException ce, ExceptionAction action)
        {
            switch (action)
            {
            case ExceptionAction.Global:
                ErrorsHelper.AddError(ref _errorsAll, ce);
                ErrorsHelper.AddError(ref _errorsGlobal, ce);
                break;

            case ExceptionAction.NonSpecific:
                ErrorsHelper.AddError(ref _errorsAll, ce);
                break;

            case ExceptionAction.Local:
                ErrorsHelper.AddError(ref _errorsLocal, ce);
                break;
            }
        }
Example #24
0
        /// <summary>
        /// Verify and Retrieve the Boolean Attribute.  If it is not
        /// a valid value then log an error and set the value to a given default.
        /// </summary>
        internal void VerifyAndGetBooleanAttribute(
            ExceptionAction action, bool defaultValue, out bool newValue)
        {
            switch (Reader.Value)
            {
            case "true":
                newValue = true;
                break;

            case "false":
                newValue = false;
                break;

            default:
                newValue = defaultValue;
                SchemaErrors.AddError(
                    new ConfigurationErrorsException(string.Format(SR.Config_invalid_boolean_attribute, Reader.Name), this),
                    action);
                break;
            }
        }
 static protected void VerifySectionName(string name, XmlUtil xmlUtil, ExceptionAction action, bool allowImplicit) {
     try {
         VerifySectionName(name, (IConfigErrorInfo) xmlUtil, allowImplicit);
     }
     catch (ConfigurationErrorsException ce) {
         xmlUtil.SchemaErrors.AddError(ce, action);
     }
 }
Example #26
0
        internal void VerifyAndGetNonEmptyStringAttribute(ExceptionAction action, out string newValue) {
            if (!String.IsNullOrEmpty(_reader.Value)) {
                newValue = _reader.Value;
            }
            else {
                newValue = null;

                ConfigurationException ex = new ConfigurationErrorsException(
                    SR.GetString(SR.Empty_attribute, _reader.Name),
                    this);

                SchemaErrors.AddError(ex, action);
            }
        }
Example #27
0
 public ExceptionCell(Type exceptionType, ExceptionAction exceptionAction)
 {
     ExceptionType   = exceptionType;
     ExceptionAction = exceptionAction;
 }
Example #28
0
        //
        // Add an error if the retrieved attribute is null, 
        // and therefore not present.
        //
        internal bool VerifyRequiredAttribute(
                object o, string attrName, ExceptionAction action) {

            if (o == null) {
                AddErrorRequiredAttribute(attrName, action);
                return false;
            }
            else {
                return true;
            }
        }
Example #29
0
        internal void AddErrorReservedAttribute(ExceptionAction action) {
            ConfigurationErrorsException ex = new ConfigurationErrorsException(
                SR.GetString(SR.Config_reserved_attribute, _reader.Name),
                this);

            SchemaErrors.AddError(ex, action);
        }
Example #30
0
        //
        // Skip this element and its children, then read to next start element,
        // or until we hit end of file. Verify that nodes that are read after the
        // skipped element are permissible.
        //
        internal void StrictSkipToNextElement(ExceptionAction action) {
            _reader.Skip();

            while (!_reader.EOF && _reader.NodeType != XmlNodeType.Element) {
                VerifyIgnorableNodeType(action);
                _reader.Read();
            }
        }
Example #31
0
 //
 // Add an error if the node type is not permitted by the configuration schema.
 //
 internal void VerifyIgnorableNodeType(ExceptionAction action) {
     XmlNodeType nodeType = _reader.NodeType;
     
     if (nodeType != XmlNodeType.Comment && nodeType != XmlNodeType.EndElement) {
         ConfigurationException ex = new ConfigurationErrorsException(
             SR.GetString(SR.Config_base_unrecognized_element), 
             this);
                         
         SchemaErrors.AddError(ex, action);
     }
 }
 internal void AddErrorUnrecognizedElement(ExceptionAction action)
 {
     ConfigurationErrorsException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_unrecognized_element"), this);
     this.SchemaErrors.AddError(ce, action);
 }
 internal void AddErrorUnrecognizedAttribute(ExceptionAction action)
 {
     ConfigurationErrorsException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_unrecognized_attribute", new object[] { this._reader.Name }), this);
     this.SchemaErrors.AddError(ce, action);
 }
 public static void Log(this Exception exception, HttpContext context, ExceptionAction action = ExceptionAction.Enqueue)
 {
     Log(exception, context, string.Empty, action);
 }
        public static void Log(this Exception exception, HttpContext context, string customMessage, ExceptionAction action = ExceptionAction.Enqueue)
        {
#if DEBUG
            return;
#endif
            var url        = "Not available";
            var urlreferer = "Not available";

            if (context != null)
            {
                url = context.Request.Url.ToString();
            }

            if (context != null && context.Request.UrlReferrer != null)
            {
                urlreferer = context.Request.UrlReferrer.ToString();
            }

            var message = new AppException
            {
                CustomMessage = string.IsNullOrWhiteSpace(customMessage) ? "AtomicLimbs.Error" : customMessage,
                Exception     = exception,
                Url           = url,
                UrlReferrer   = urlreferer,
            };

            try
            {
                if (ExceptionAction.Enqueue.Equals(action) || ExceptionAction.SendMailAndEnqueue.Equals(action))
                {
                    AzureQueue.Enqueue(message);
                }
            }
            catch (Exception)
            {
                //estamos en la B, error del error
            }

            try
            {
                if (ExceptionAction.SendMail.Equals(action) || ExceptionAction.SendMailAndEnqueue.Equals(action))
                {
                    var mailserver = ConfigurationManager.AppSettings["Mail.Server"];
                    var username   = ConfigurationManager.AppSettings["Mail.Username"];
                    var password   = ConfigurationManager.AppSettings["Mail.Password"];
                    var from       = ConfigurationManager.AppSettings["Mail.From"];
                    var adminmail  = ConfigurationManager.AppSettings["AdminEmails"];

                    var mailSender  = new GeneralMailSender(mailserver, username, password);
                    var mailMessage = new System.Net.Mail.MailMessage(from, adminmail?.Split(',')[0] ?? throw new InvalidOperationException(), message.CustomMessage, message.Url + "\n\n" + message.UrlReferrer + "\n\n" + message.Exception + "\n\n" + message.LogMessage + "\n\n" + message.Message + "\n\n" + message.StackTrace + "\n\n" + message.InnerExceptionMessage);

                    // si el mensaje es null significa que el maker controló algunas situaciones y no hay nada para enviar y el mensaje se puede remover de la queue
                    mailSender.Send(mailMessage);
                }
            }
            catch (Exception e)
            {
                //estamos en la B, error del error
            }

            try
            {
                var ai = new TelemetryClient();
                ai.TrackException(exception);
            }
            catch (Exception)
            {
                //estamos en la B, error del error
            }
        }
Example #36
0
 /// <summary>
 /// Verify and Retrieve the Boolean Attribute.  If it is not
 /// a valid value then log an error and set the value to a given default.
 /// </summary>
 internal void VerifyAndGetBooleanAttribute(
     ExceptionAction action, bool defaultValue, out bool newValue)
 {
     switch (Reader.Value)
     {
         case "true":
             newValue = true;
             break;
         case "false":
             newValue = false;
             break;
         default:
             newValue = defaultValue;
             SchemaErrors.AddError(
                 new ConfigurationErrorsException(string.Format(SR.Config_invalid_boolean_attribute, Reader.Name), this),
                 action);
             break;
     }
 }
Example #37
0
        internal void AddErrorUnrecognizedAttribute(ExceptionAction action)
        {
            ConfigurationErrorsException ex = new ConfigurationErrorsException(
                string.Format(SR.Config_base_unrecognized_attribute, Reader.Name),
                this);

            SchemaErrors.AddError(ex, action);
        }
Example #38
0
 /// <summary>
 /// Add an error if the retrieved attribute is null, and therefore not present.
 /// </summary>
 internal bool VerifyRequiredAttribute(object requiredAttribute, string attrName, ExceptionAction action)
 {
     if (requiredAttribute == null)
     {
         AddErrorRequiredAttribute(attrName, action);
         return(false);
     }
     else
     {
         return(true);
     }
 }
Example #39
0
 public void SetDefaultProcess(ExceptionAction exceptionAction)
 {
     exceptionArray[0].ExceptionAction = exceptionAction;
 }
 internal void VerifyIgnorableNodeType(ExceptionAction action)
 {
     XmlNodeType nodeType = this._reader.NodeType;
     if ((nodeType != XmlNodeType.Comment) && (nodeType != XmlNodeType.EndElement))
     {
         ConfigurationException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_base_unrecognized_element"), this);
         this.SchemaErrors.AddError(ce, action);
     }
 }
Example #41
0
        //
        // Read to the next start element, and verify that all XML nodes read are permissible.
        //
        internal void StrictReadToNextElement(ExceptionAction action) {
            while (_reader.Read()) {
                // optimize for the common case
                if (_reader.NodeType == XmlNodeType.Element) {
                    return;
                }

                VerifyIgnorableNodeType(action);
            }
        }
 internal void AddErrorRequiredAttribute(string attrib, ExceptionAction action)
 {
     ConfigurationErrorsException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_missing_required_attribute", new object[] { attrib, this._reader.Name }), this);
     this.SchemaErrors.AddError(ce, action);
 }
Example #43
0
        //
        // StrictSkipToOurParentsEndElement
        //
        // Skip until we hit the end element for our parent, and verify
        // that nodes at the parent level are permissible.
        //
        internal void StrictSkipToOurParentsEndElement(ExceptionAction action) {
            int currentDepth = _reader.Depth;

            // Skip everything at out current level
            while (_reader.Depth >= currentDepth) {
                _reader.Skip();
            }

            while (!_reader.EOF && _reader.NodeType != XmlNodeType.EndElement) {
                VerifyIgnorableNodeType(action);
                _reader.Read();
            }
        }
 internal void VerifyAndGetNonEmptyStringAttribute(ExceptionAction action, out string newValue)
 {
     if (!string.IsNullOrEmpty(this._reader.Value))
     {
         newValue = this._reader.Value;
     }
     else
     {
         newValue = null;
         ConfigurationException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Empty_attribute", new object[] { this._reader.Name }), this);
         this.SchemaErrors.AddError(ce, action);
     }
 }
Example #45
0
 //
 // Add an error if there are attributes that have not been examined,
 // and are therefore unrecognized.
 //
 internal void VerifyNoUnrecognizedAttributes(ExceptionAction action) {
     if (_reader.MoveToNextAttribute()) {
         AddErrorUnrecognizedAttribute(action);
     }
 }
 internal void VerifyAndGetBooleanAttribute(ExceptionAction action, bool defaultValue, out bool newValue)
 {
     if (this._reader.Value == "true")
     {
         newValue = true;
     }
     else if (this._reader.Value == "false")
     {
         newValue = false;
     }
     else
     {
         newValue = defaultValue;
         ConfigurationErrorsException ce = new ConfigurationErrorsException(System.Configuration.SR.GetString("Config_invalid_boolean_attribute", new object[] { this._reader.Name }), this);
         this.SchemaErrors.AddError(ce, action);
     }
 }
Example #47
0
        internal void AddErrorRequiredAttribute(string attrib, ExceptionAction action) {
            ConfigurationErrorsException ex = new ConfigurationErrorsException(
                SR.GetString(SR.Config_missing_required_attribute, attrib, _reader.Name),
                this);

            SchemaErrors.AddError(ex, action);
        }
 internal void StrictSkipToOurParentsEndElement(ExceptionAction action)
 {
     int depth = this._reader.Depth;
     while (this._reader.Depth >= depth)
     {
         this._reader.Skip();
     }
     while (!this._reader.EOF && (this._reader.NodeType != XmlNodeType.EndElement))
     {
         this.VerifyIgnorableNodeType(action);
         this._reader.Read();
     }
 }
Example #49
0
        internal void AddErrorUnrecognizedElement(ExceptionAction action) {
            ConfigurationErrorsException ex = new ConfigurationErrorsException(
                SR.GetString(SR.Config_base_unrecognized_element),
                this);

            SchemaErrors.AddError(ex, action);
        }
 internal void StrictReadToNextElement(ExceptionAction action)
 {
     while (this._reader.Read())
     {
         if (this._reader.NodeType == XmlNodeType.Element)
         {
             return;
         }
         this.VerifyIgnorableNodeType(action);
     }
 }
Example #51
0
        // VerifyAndGetBooleanAttribute
        //
        // Verify and Retrieve the Boolean Attribute.  If it is not
        // a valid value then log an error and set the value to a given default.
        //
        internal void VerifyAndGetBooleanAttribute(
                ExceptionAction action, bool defaultValue, out bool newValue) {

            if (_reader.Value == "true") {
                newValue = true;
            }
            else if (_reader.Value == "false") {
                newValue = false;
            }
            else {
                // Unrecognized value
                newValue = defaultValue;

                ConfigurationErrorsException ex = new ConfigurationErrorsException(
                    SR.GetString(SR.Config_invalid_boolean_attribute, _reader.Name), 
                    this);

                SchemaErrors.AddError(ex, action);
            }
        }
Example #52
0
        dbgExceptionAction ConvertExceptionAction(ExceptionAction action)
        {
            switch (action)
            {
                case ExceptionAction.Default:
                    return dbgExceptionAction.dbgExceptionActionDefault;

                case ExceptionAction.Ignore:
                    return dbgExceptionAction.dbgExceptionActionContinue;

                case ExceptionAction.Break:
                    return dbgExceptionAction.dbgExceptionActionBreak;

                case ExceptionAction.Continue:
                    return dbgExceptionAction.dbgExceptionActionContinue;

                default:
                    throw new ArgumentException();
            }
        }
Example #53
0
 public ExceptionBehaviorAttribute(Type exceptionType, ExceptionAction action)
 {
     this.exceptionType = exceptionType;
     this.action        = action;
 }
Example #54
0
        //TODO: Return NOT void. Problem with ExceptionMiddleware
        public static async void Log(this Exception exception, HttpContext context, Guid idGuid, string source = "Microservices", string customMessage = "CienciaArgentina.Error", ExceptionAction action = ExceptionAction.Enqueue)
        {
            var url        = "Not available";
            var urlreferer = "Not available";

            if (context != null)
            {
                var request = context.Request;
                urlreferer = context.Request.Headers["Referer"].ToString();

                url = $"{request.Scheme}://" +
                      $"{request.Host.ToUriComponent()}" +
                      $"{request.PathBase.ToUriComponent()}" +
                      $"{request.Path.ToUriComponent()}" +
                      $"{request.QueryString.ToUriComponent()}";

                if (context.User?.Identity != null && context.User.Identity.IsAuthenticated)
                {
                    customMessage += $"| LoggedUser: {context.User.Identity.Name}";
                }
            }

            var message = new AppException
            {
                IdFront       = idGuid.ToString(),
                CustomMessage = customMessage,
                Message       = exception.Message,
                Detail        = exception.StackTrace,
                Url           = url,
                UrlReferrer   = urlreferer,
                Source        = source
            };

            try
            {
                if (ExceptionAction.Enqueue.Equals(action) || ExceptionAction.SendMailAndEnqueue.Equals(action))
                {
                    await AzureQueue.Enqueue(message);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //estamos en la B, error del error
            }

            try
            {
                if (ExceptionAction.SendMail.Equals(action) || ExceptionAction.SendMailAndEnqueue.Equals(action))
                {
                    //TODO: Hacer mail

                    //var mailserver = ConfigurationManager.AppSettings["Mail.Server"];
                    //var username = ConfigurationManager.AppSettings["Mail.Username"];
                    //var password = ConfigurationManager.AppSettings["Mail.Password"];
                    //var from = ConfigurationManager.AppSettings["Mail.From"];
                    //var adminmail = ConfigurationManager.AppSettings["AdminEmails"];

                    //var mailSender = new GeneralMailSender(mailserver, username, password);
                    //var mailMessage = new System.Net.Mail.MailMessage(from, adminmail?.Split(',')[0] ?? throw new InvalidOperationException(), message.CustomMessage, message.Url + "\n\n" + message.UrlReferrer + "\n\n" + message.Exception);

                    // si el mensaje es null significa que el maker controló algunas situaciones y no hay nada para enviar y el mensaje se puede remover de la queue
                    //mailSender.Send(mailMessage);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            try
            {
                var ai = new TelemetryClient();
                ai.TrackException(exception);
            }
            catch (Exception)
            {
                //estamos en la B, error del error
            }
        }
Example #55
0
        public bool GenericExceptionCatchPoint(string exception, out ExceptionAction action)
        {
            if (generic_exc_handler != null)
                return generic_exc_handler (exception, out action);

            action = ExceptionAction.None;
            return false;
        }
 public static void Log(this Exception exception, ExceptionAction action = ExceptionAction.Enqueue)
 {
     Log(exception, null, string.Empty, action);
 }